This commit is contained in:
tamaina 2023-01-02 18:42:00 +00:00
parent 49da90289a
commit 80f9a81ac4
14 changed files with 191 additions and 271 deletions

View file

@ -84,17 +84,17 @@ 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 fetch(endpoint, {
const res = await this.httpRequestService.fetch({
url: endpoint,
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'User-Agent': config.userAgent,
Accept: 'application/json, */*',
},
body: params,
body: params.toString(),
// TODO
//timeout: 10000,
agent: (url) => this.httpRequestService.getAgentByUrl(url),
});
const json = (await res.json()) as {