Use JSON for DeepL API requests
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
parent
93ce56418e
commit
ae2c97fad8
2 changed files with 9 additions and 10 deletions
1
changelog.d/deepl-json.fix
Normal file
1
changelog.d/deepl-json.fix
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
Use JSON for DeepL API requests
|
||||||
|
|
@ -24,17 +24,15 @@ defmodule Pleroma.Language.Translation.Deepl do
|
||||||
|> URI.to_string()
|
|> URI.to_string()
|
||||||
|
|
||||||
case Pleroma.HTTP.post(
|
case Pleroma.HTTP.post(
|
||||||
endpoint <>
|
endpoint,
|
||||||
"?" <>
|
Jason.encode!(%{
|
||||||
URI.encode_query(%{
|
text: [content],
|
||||||
text: content,
|
source_lang: source_language |> String.upcase(),
|
||||||
source_lang: source_language |> String.upcase(),
|
target_lang: target_language,
|
||||||
target_lang: target_language,
|
tag_handling: "html"
|
||||||
tag_handling: "html"
|
}),
|
||||||
}),
|
|
||||||
"",
|
|
||||||
[
|
[
|
||||||
{"Content-Type", "application/x-www-form-urlencoded"},
|
{"Content-Type", "application/json"},
|
||||||
{"Authorization", "DeepL-Auth-Key #{api_key()}"}
|
{"Authorization", "DeepL-Auth-Key #{api_key()}"}
|
||||||
]
|
]
|
||||||
) do
|
) do
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue