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

Fixed invalid json in case of empty json body #14

Merged
merged 2 commits into from Oct 14, 2015
Merged

Fixed invalid json in case of empty json body #14

merged 2 commits into from Oct 14, 2015

Conversation

whiskeysierra
Copy link
Collaborator

This fixes #13

@@ -100,7 +100,7 @@ private void addBody(final HttpMessage request, final ImmutableMap.Builder<Strin
final String body = request.getBodyAsString();

if (isJson(request.getContentType())) {
builder.put("body", new JsonBody(compactJson(body)));
builder.put("body", body.isEmpty() ? JsonBody.NULL : new JsonBody(compactJson(body)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be an empty string instead? Otherwise you can't distinguish between an empty body and a body containing the string "null".

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. I changed it to an empty string.

whiskeysierra added a commit that referenced this pull request Oct 14, 2015
Fixed invalid json in case of empty json body
@whiskeysierra whiskeysierra merged commit 322628f into zalando:master Oct 14, 2015
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.

Support empty bodies for application/json messages
2 participants