mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
LibreTranslateTranslator: move headers to plain object, add url variable
This commit is contained in:
parent
655e94ef91
commit
df3b8863df
1 changed files with 5 additions and 4 deletions
|
|
@ -57,13 +57,14 @@ export class LibreTranslateTranslator implements DittoTranslator {
|
|||
api_key: this.apiKey,
|
||||
};
|
||||
|
||||
const headers = new Headers();
|
||||
headers.append('Content-Type', 'application/json');
|
||||
const url = new URL('/translate', this.baseUrl);
|
||||
|
||||
const request = new Request(new URL('/translate', this.baseUrl), {
|
||||
const request = new Request(url, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
headers,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
signal: opts?.signal,
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue