added test file and changed hopefully to utf8 translation

This commit is contained in:
Falko Victor Habel 2024-06-21 09:51:00 +02:00
parent 68032cb37d
commit ff4aa0f63e
2 changed files with 19 additions and 1 deletions

View File

@ -126,7 +126,7 @@ func executeTranslator(w http.ResponseWriter, message, fromLanguage, toLanguage
scanner := bufio.NewScanner(output) scanner := bufio.NewScanner(output)
for scanner.Scan() { for scanner.Scan() {
messages <- scanner.Text() messages <- string(scanner.Bytes())
} }
err = cmd.Wait() err = cmd.Wait()

18
tests/test.py Normal file
View File

@ -0,0 +1,18 @@
import requests
import json
url = "https://tl.fabelous.app/api/rogQxDpALQdFDEYihACT/"
headers = {
"Authorization": "Token yQfZjxLCWYZQXTjepQAm",
"Content-Type": "application/json"
}
data = {
"message": "Hello, world!",
"from": "en",
"to": "de"
}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.status_code)
print(response.json())