-
Notifications
You must be signed in to change notification settings - Fork 264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handling of form requests is now configurable #184
Conversation
|
||
private byte[] reconstructBodyFromParameters() { | ||
return getParameterMap().entrySet().stream() | ||
.flatMap(entry -> Arrays.stream(entry.getValue()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Key and entry should be escaped (imagine name=Johnson & Johnson
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't be 100% certain how the parameters were passed to us in the first place. They could come from the query string as well as the body. In addition, we don't know whether they were encoded. It's a judgement call now, since in the end we want to log them and present them to humans (unencoded, since that would be easier) but on the other hand we want to preserve the format on the wire (encoded, most likely).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we log real body, how would it look like? Should reconstructed be as close as possible in its form to real one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we log real body, how would it look like?
Untouched, i.e. encoded.
Should reconstructed be as close as possible in its form to real one?
Yes.
} | ||
|
||
private static String encode(final String s) { | ||
return encode(s, "UTF-8"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may use UTF_8.name()
👍 |
Fixes #94
Fixes #169
@xingfinal @wyzssw @hanfak