Skip to content

Commit 9b0f717

Browse files
fix: also send Formality in API requests if it is set to default
1 parent 943f04e commit 9b0f717

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
### Deprecated
1212
### Removed
1313
### Fixed
14+
* Send Formality options in API requests even if it is default.
1415
### Security
1516

1617

deepl-java/src/main/java/com/deepl/api/Translator.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ private static ArrayList<KeyValuePair<String, String>> createHttpParamsCommon(
848848
}
849849
params.add(new KeyValuePair<>("target_lang", targetLang));
850850

851-
if (formality != null && formality != Formality.Default) {
851+
if (formality != null) {
852852
switch (formality) {
853853
case More:
854854
params.add(new KeyValuePair<>("formality", "more"));
@@ -862,7 +862,9 @@ private static ArrayList<KeyValuePair<String, String>> createHttpParamsCommon(
862862
case PreferLess:
863863
params.add(new KeyValuePair<>("formality", "prefer_less"));
864864
break;
865+
case Default:
865866
default:
867+
params.add(new KeyValuePair<>("formality", "default"));
866868
break;
867869
}
868870
}

0 commit comments

Comments
 (0)