This commit is contained in:
syuilo 2022-04-16 17:19:30 +09:00
parent 343555038f
commit 45a1149655
5 changed files with 9 additions and 9 deletions

View File

@ -1,5 +1,5 @@
declare module 'http-signature' {
import { IncomingMessage, ClientRequest } from 'http';
import { IncomingMessage, ClientRequest } from 'node:http';
interface ISignature {
keyId: string;

View File

@ -1,10 +1,10 @@
import * as http from 'http';
import * as https from 'https';
import * as http from 'node:http';
import * as https from 'node:https';
import { URL } from 'node:url';
import CacheableLookup from 'cacheable-lookup';
import fetch from 'node-fetch';
import { HttpProxyAgent, HttpsProxyAgent } from 'hpagent';
import config from '@/config/index.js';
import { URL } from 'node:url';
export async function getJson(url: string, accept = 'application/json, */*', timeout = 10000, headers?: Record<string, string>) {
const res = await getResponse({
@ -35,7 +35,7 @@ export async function getHtml(url: string, accept = 'text/html, */*', timeout =
}
export async function getResponse(args: { url: string, method: string, body?: string, headers: Record<string, string>, timeout?: number, size?: number }) {
const timeout = args?.timeout || 10 * 1000;
const timeout = args.timeout || 10 * 1000;
const controller = new AbortController();
setTimeout(() => {
@ -47,7 +47,7 @@ export async function getResponse(args: { url: string, method: string, body?: st
headers: args.headers,
body: args.body,
timeout,
size: args?.size || 10 * 1024 * 1024,
size: args.size || 10 * 1024 * 1024,
agent: getAgentByUrl,
signal: controller.signal,
});

View File

@ -1,4 +1,4 @@
import * as http from 'http';
import * as http from 'node:http';
import * as websocket from 'websocket';
import MainStreamConnection from './stream/index.js';

View File

@ -3,7 +3,7 @@
*/
import * as fs from 'node:fs';
import * as http from 'http';
import * as http from 'node:http';
import Koa from 'koa';
import Router from '@koa/router';
import mount from 'koa-mount';

View File

@ -4,7 +4,7 @@ import * as misskey from 'misskey-js';
import fetch from 'node-fetch';
import FormData from 'form-data';
import * as childProcess from 'child_process';
import * as http from 'http';
import * as http from 'node:http';
import loadConfig from '../src/config/load.js';
import { SIGKILL } from 'constants';
import { entities } from '../src/db/postgre.js';