Numbers before and after response body

Hello!

I’m in the process of creating a chatbot and I want to interact with the Twitch API as part of the functionality.
I send the following request:

GET /kraken/streams/hackerc0w HTTP/1.1
Connection: close
Host: api.twitch.tv
Accept: application/vnd.twitchtv.v3+json
Authorization: OAuth [token]

and I want to parse the result into JSON. If I just request /kraken, this works fine and the response body is parsed into JSON, but when I send the request shown above, this is what the response looks like:

Transfer-Encoding: chunked
[...]
Front-End-Https: on

8e
{"_links":{"self":"https://api.twitch.tv/kraken/streams/hackerc0w","channel":"ht
ps://api.twitch.tv/kraken/channels/hackerc0w"},"stream":null}
0

Notice the trailing 8e and the 0 at the end. This makes my JSON Parser unable to parse the response.
Is this known to have happened before? I am 99% sure my client code is correct, as it works with /kraken.

I would appreciate any help on this topic!

That’s how Transfer-Encoding: chunked works. It’s part of the HTTP protocol. Please use a HTTP client, not a TCP client.

Ok, thank you for the answer, I will look into that.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.