Hello.
At Jul 30 20:21:33 UTC
I’ve got the HTML response for API request:
Jul 30 23:21:33 : I, [2020-07-31T00:21:33.214532 #24791] INFO -- request: GET https://api.twitch.tv
/kraken/streams/112353016?stream_type=live
Jul 30 23:21:33 : I, [2020-07-31T00:21:33.214627 #24791] INFO -- request: Accept: "application/vnd.
twitchtv.v5+json"
Jul 30 23:21:33 : User-Agent: "Faraday v1.0.1"
Jul 30 23:21:33 : Client-ID: "secret"
Jul 30 23:21:33 : Authorization: "OAuth secret too"
Jul 30 23:21:33 : I, [2020-07-31T00:21:33.402674 #24791] INFO -- response: Status 502
Jul 30 23:21:33 : I, [2020-07-31T00:21:33.402837 #24791] INFO -- response: connection: "keep-alive"
Jul 30 23:21:33 : content-length: "138"
Jul 30 23:21:33 : server: "awselb/2.0"
Jul 30 23:21:33 : content-type: "text/html"
Jul 30 23:21:33 : date: "Thu, 30 Jul 2020 21:21:33 GMT"
Jul 30 23:21:33 : x-served-by: "cache-sea4479-SEA, cache-hel6820-HEL"
Jul 30 23:21:33 : x-cache: "MISS, MISS"
Jul 30 23:21:33 : x-cache-hits: "0, 0"
Jul 30 23:21:33 : x-timer: "S1596144093.223654,VS0,VS0,VE175"
Jul 30 23:21:33 : strict-transport-security: "max-age=300"
Jul 30 23:21:33 : I, [2020-07-31T00:21:33.402904 #24791] INFO -- response: <html>
Jul 30 23:21:33 : <head><title>502 Bad Gateway</title></head>
Jul 30 23:21:33 : <body bgcolor="white">
Jul 30 23:21:33 : <center><h1>502 Bad Gateway</h1></center>
Jul 30 23:21:33 : </body>
Jul 30 23:21:33 : </html>
Jul 30 23:21:33 : #<Thread:0x000055af31f7a158 /home/my_project/src/twitch/channel.rb:37 ru
n> terminated with exception (report_on_exception is true):
Jul 30 23:21:33 : /home/my_project/.rbenv/versions/2.7.1/lib/ruby/2.7.0/json/common.rb:156:in
`parse': 783: unexpected token at '<html>\r (Faraday::ParsingError)
So, my code had the exception when tried to parse this HTML as JSON.
You have no rights to send any HTML from JSON API end-points.