my local server is running in port 5005 and at first i was able to translate but now im getting this error:
“body used already for: http://127.0.0.1:5005/translate”
my way of requsting is this:
async function testLocalTrans(text, languageCode) {
try {
console.log(“in local translation”);
const res = await fetch(“http://127.0.0.1:5005/translate”, {
method: “POST”,
body: JSON.stringify({
q: text,
source: “en”,
target: languageCode.toLowerCase(),
format: “text”,
api_key: “”
}),
headers: { “Content-Type”: “application/json” }
});
const responseBody = await res.json(); // Store the response body in a variable
console.log(responseBody);
return responseBody;
} catch (error) {
console.error('Error translating text:', error.message || error);
// logger.error(logger.formatLogMessage('exception', '', 'translateText', 'error', error));
return error.message;
}
}
has someone got this error before and if so how did you fix it?