-
Notifications
You must be signed in to change notification settings - Fork 741
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
Decoding errror with content-encoding 'gzip' #751
Comments
@skaldarnar When I run your code above I don't get the error you're seeing. The library intentionally add You've provided an excellent issue report, but I'm not sure what is causing the error you're seeing. |
@bitwiseman thank you, and yeah, me neither 😕 I'll give my debugging attempts another try and put some breakpoints at the line you've pointed me to. Edit: I've just run the example with different Java versions - no difference on macOS:
|
Tried on 64-bit Windows with Java 8
Also getting the following:
|
Same when trying on 64-bit Linux (same Java Version and JDK). Could it be related to the JDK? 🤔 |
I'm seeing the same issue. While I'm debugging in It's not clear why this is resolving to null, since if I call the same GitHub API with |
OK, found the problem: |
Switching the implementation of public String headerField(String name) {
return headers.entrySet()
.stream()
.filter(entry -> name.equalsIgnoreCase(entry.getKey()))
.findFirst()
.map(entry -> entry.getValue().get(0))
.orElse(null);
} I'll raise a PR, but I'm struggling to create a test case at the moment because (the ironies) I can't persuade WireMock not to capitalise the |
Would appreciate some input from maintainers about whether lambdas/streams ☝️ are acceptable from a style perspective. |
Lambdas and streams are fine.This library only recently moved to Java 8+ so there's probably a number of places where streams and lambdas would be helpful. We're using lambdas in a number of places already. Note, I'm not loving using it in this case. Multiple calls to
Probably have to do the same with |
@tomakehurst
|
GitHub has started changing their headers from capitalized words to all lowercase. A recent change made the header fields querying case-senstive. This fixes that mistake and also extends that funcionality to anyone consuming the headers generated by ResponseInfo. Fixes hub4j#751
GitHub has started changing their headers from capitalized words to all lowercase. A recent change made the header fields querying case-senstive which broke gzip content detection. This was not caught by tests because recorded files remain unchanged. It is also possible that WireMock is auto-capitalizing. This fixes the case-sensitivity issue and also extends that funcionality to anyone consuming the headers generated by ResponseInfo. Fixes hub4j#751
For anyone wondering problem is that this line: And the recorded files still have the mixed-case names. |
@tomakehurst Jetty uses |
The issue is definitely Jetty, but it happens even when I haven't yet managed to figure out why/where it's rewriting that particular header. |
Describe the bug
When trying to fetch an organization from public GitHub via
getOrganization("...")
the response body cannot be parsed correctly and the method throws anIOException
.There seems to be an issue with whitespaces in the (assumed) JSON response, indicated by
Illegal character ((CTRL-CHAR, code 31))
. Some debugging down toGithubResponse::parseBody
shows thatresolves to
"gzip"
for some reason.Here is the full stacktrace:
To Reproduce
This is the MWE from my code to reproduce this error.
Expected behavior
I expect that a response with 200 OK is parsed correctly and does not throw an IOException.
Alternatively, is there a way to set custom headers, e.g., setting "accept-encoding" to ensure the lib can parse the response body?
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: