fix(server): node-fetchおよびgotを使う以前の実装に戻す

see #9710
This commit is contained in:
syuilo 2023-01-25 12:00:04 +09:00
parent 2a2e8d0cf6
commit d4fb201d05
13 changed files with 203 additions and 427 deletions

View file

@ -7,8 +7,8 @@ import { DI } from '@/di-symbols.js';
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
import { MetaService } from '@/core/MetaService.js';
import { HttpRequestService } from '@/core/HttpRequestService.js';
import { ApiError } from '../../error.js';
import { GetterService } from '@/server/api/GetterService.js';
import { ApiError } from '../../error.js';
export const meta = {
tags: ['notes'],
@ -83,20 +83,14 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
const endpoint = instance.deeplIsPro ? 'https://api.deepl.com/v2/translate' : 'https://api-free.deepl.com/v2/translate';
const res = await this.httpRequestService.fetch(
endpoint,
{
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
Accept: 'application/json, */*',
},
body: params.toString(),
const res = await this.httpRequestService.send(endpoint, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
Accept: 'application/json, */*',
},
{
noOkError: false,
}
);
body: params.toString(),
});
const json = (await res.json()) as {
translations: {