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

Binary output when talking to Twitter API #240

Open
jsha opened this issue Mar 20, 2017 · 1 comment
Open

Binary output when talking to Twitter API #240

jsha opened this issue Mar 20, 2017 · 1 comment

Comments

@jsha
Copy link

jsha commented Mar 20, 2017

The Twitter API uses HTTP/2, but trying to access it with node-http2 results in binary output rather than the expected textual output.

Steps to reproduce:

$ node node_modules/http2/example/client.js https://api.twitter.com/robots.txt
x�T�A
�0��}N1�Nhf�u��H�3�LȄ��
                       �����OtSzH��H� _+��J%Z��콪cؐ����k������e��aE��̸o��(�}
                                                                          �t3'�9���������*
$ curl https://api.twitter.com/robots.txt
# Used for Google app indexing. See https://developers.google.com/app-indexing/webmasters/server
User-agent: Googlebot
Disallow:

User-agent: *
Disallow: /
@jsha
Copy link
Author

jsha commented Mar 20, 2017

This appears to be related to deflate encoding. Adding code to print the headers shows 'content-encoding': 'deflate',, and piping the output to perl -MCompress::Zlib -e 'undef $/; print uncompress(<>)' results in correct output.

Poking through the source it looks like this library doesn't yet support either gzip or deflate, so it should probably send a blank Accept-Encoding header.

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

1 participant