-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow null values with FormUrlEncodedHttp[De]Serializer (#2554)
Motivation: At the moment the behavior around null (and to an extent empty) values is a little bit unflexible. ServiceTalk makes the decision to ignore null values on encoding and converting them to the same value as an empty string on decoding. Since there is no spec which says that null values are disallowed, it is better if ServiceTalk is flexible and lets the user decide if they want to ignore values (which they can do by checking and then just not encoding them in the first place). Modifications: This changeset modifies behavior as follows. On the encoding side: - null values are now allowed and encoded as "just" the key, instead of not being encoded at all. (Distinguished without an "=" compared to an empty string) On the decoding side: - Null values are now not turned into an empty string, but if just the key is present turned into "null" - and if the "=" is present, an empty string is decoded. Note: this also implicitly changes the resulting HttpQuery behavior when calling lazyParseQueryString on HttpRequestMetaData, since it uses the same functionality underneath. Since the "get" method is marked as `Nullable` already, there is no illegal behavior observed.
- Loading branch information
Showing
5 changed files
with
144 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.