Use node-fetch instead of request (#6228)
* requestをnode-fetchになど * format * fix error * t * Fix test
This commit is contained in:
parent
bb7edfee04
commit
d3c0f3c251
12 changed files with 140 additions and 218 deletions
|
@ -1,5 +1,4 @@
|
|||
import config from '../config';
|
||||
import * as request from 'request-promise-native';
|
||||
import { getJson } from '../misc/fetch';
|
||||
import { query as urlQuery } from '../prelude/url';
|
||||
|
||||
type ILink = {
|
||||
|
@ -15,17 +14,7 @@ type IWebFinger = {
|
|||
export default async function(query: string): Promise<IWebFinger> {
|
||||
const url = genUrl(query);
|
||||
|
||||
return await request({
|
||||
url,
|
||||
proxy: config.proxy,
|
||||
timeout: 10 * 1000,
|
||||
forever: true,
|
||||
headers: {
|
||||
'User-Agent': config.userAgent,
|
||||
Accept: 'application/jrd+json, application/json'
|
||||
},
|
||||
json: true
|
||||
});
|
||||
return await getJson(url, 'application/jrd+json, application/json');
|
||||
}
|
||||
|
||||
function genUrl(query: string) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue