Skip to content

Commit

Permalink
fix: also send Formality in API requests if it is set to default
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-jones-dev committed Jan 24, 2023
1 parent 943f04e commit 9b0f717
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Deprecated
### Removed
### Fixed
* Send Formality options in API requests even if it is default.
### Security


Expand Down
4 changes: 3 additions & 1 deletion deepl-java/src/main/java/com/deepl/api/Translator.java
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ private static ArrayList<KeyValuePair<String, String>> createHttpParamsCommon(
}
params.add(new KeyValuePair<>("target_lang", targetLang));

if (formality != null && formality != Formality.Default) {
if (formality != null) {
switch (formality) {
case More:
params.add(new KeyValuePair<>("formality", "more"));
Expand All @@ -862,7 +862,9 @@ private static ArrayList<KeyValuePair<String, String>> createHttpParamsCommon(
case PreferLess:
params.add(new KeyValuePair<>("formality", "prefer_less"));
break;
case Default:
default:
params.add(new KeyValuePair<>("formality", "default"));
break;
}
}
Expand Down

0 comments on commit 9b0f717

Please sign in to comment.