commit: 490a273dc1429fe2ae4ca9b8ad4eb12f4b92860d
parent ca7dd87e2de41ffaf6ad754fdb01b6548df02cbe
Author: vaartis <vaartis@kotobank.ch>
Date: Wed, 18 Jun 2025 12:11:35 +0000
Merge branch 'deepl-fix' into 'develop'
Use JSON for DeepL API requests
See merge request pleroma/pleroma!4363
Diffstat:
2 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/changelog.d/deepl-json.fix b/changelog.d/deepl-json.fix
@@ -0,0 +1 @@
+Use JSON for DeepL API requests
diff --git a/lib/pleroma/language/translation/deepl.ex b/lib/pleroma/language/translation/deepl.ex
@@ -24,17 +24,15 @@ defmodule Pleroma.Language.Translation.Deepl do
|> URI.to_string()
case Pleroma.HTTP.post(
- endpoint <>
- "?" <>
- URI.encode_query(%{
- text: content,
- source_lang: source_language |> String.upcase(),
- target_lang: target_language,
- tag_handling: "html"
- }),
- "",
+ endpoint,
+ Jason.encode!(%{
+ text: [content],
+ source_lang: source_language |> String.upcase(),
+ target_lang: target_language,
+ tag_handling: "html"
+ }),
[
- {"Content-Type", "application/x-www-form-urlencoded"},
+ {"Content-Type", "application/json"},
{"Authorization", "DeepL-Auth-Key #{api_key()}"}
]
) do