Use node-fetch instead of request (#6228)

* requestをnode-fetchになど

* format

* fix error

* t

* Fix test
This commit is contained in:
MeiMei 2020-04-09 23:42:23 +09:00 committed by GitHub
parent bb7edfee04
commit d3c0f3c251
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 140 additions and 218 deletions

View file

@ -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) {