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

Incorrect content-length when multibyte UTF-8 characters are present in calls to API Gateway #62

Closed
setn opened this issue Oct 6, 2015 · 2 comments

Comments

@setn
Copy link

setn commented Oct 6, 2015

The Content-Length calculation in ApiClientHandler.java calculates the number of characters in the content rather than the "decimal number of OCTETs". The untested code below attempts to resolve this.

// Row 137-140 ApiClientHandler.java
if (hasContent) {
    byte[] contentBytes = content.getBytes(StringUtils.UTF8);
    request.setContent(new ByteArrayInputStream(contentBytes));
    request.addHeader("Content-Length", String.valueOf(contentBytes.length));
}
@wdane
Copy link
Contributor

wdane commented Oct 6, 2015

Thanks for pointing this out! I've fixed this, and it will be released soon. I'll leave this issue open until it is.

@wdane
Copy link
Contributor

wdane commented Oct 14, 2015

@wdane wdane closed this as completed 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

No branches or pull requests

2 participants