Skip to content
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

Merged
merged 2 commits into from
Nov 22, 2017

Conversation

whiskeysierra
Copy link
Collaborator


private byte[] reconstructBodyFromParameters() {
return getParameterMap().entrySet().stream()
.flatMap(entry -> Arrays.stream(entry.getValue())
Copy link
Member

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)

Copy link
Collaborator Author

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).

Copy link
Member

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?

Copy link
Collaborator Author

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");
Copy link
Member

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()

@AlexanderYastrebov
Copy link
Member

👍

@whiskeysierra whiskeysierra merged commit b2eecfb into master Nov 22, 2017
@whiskeysierra whiskeysierra deleted the feature/form-parameters branch November 22, 2017 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants