When I view an http response, it seems the http toolkit failed to decode the response body to json, and I've no idea how to read the response body.
Request Header:
Connection: keep-alive
Accept-Encoding: gzip
User-Agent: okhttp/4.9.0
Response Header:
Connection: keep-alive
Transfer-Encoding: chunked
Content-Type: application/json; charset=UTF-8
Http Toolkit shows the error: End of file expected.json(0)
Here's the raw data:
594962502f4a30374579573736385535524e427765376a4e497953544639644436506c645952427a4661764738487277762f456a4c693564454d6846665a2f4a65667a533858736d64535766753879687037664c516258747863494c33667937355350694c74664e383948677844534b4c6d55462f6879437057746f313749623070535137754c4e774b57445a684563354c6b4b777a474c55304f383278514e77622b67704672376144634567304b4c4d5939436b4b4e514c69652f51524d7a304f484f454244466d4c35696b47364d4d586c4d4b744572345a306f4239345239416c6a7557584e487451746e70375151424266754f6b4375637945715178677239514a54386d534d4561753537366d5a36334e723958422f6b42436c73556c63587679556a73636b46446f706d424c716c457444507064724572467a6f367777734c73716a646170516b5a647459486668384c2b53646a42794b7248324a4854716362747136483435334949797361534a7a5934435a7a41744f455566786235354b71683066734c58783353436f65593562687655744458454e55616137785a423273503032486d6151347675384c6a52504e5a716d682f4854676e7039714f4450796f63706c513850455231724a727a334a4251374748366468326f486976573454705879504f5562786c42734e51444730766d6347436c463579434d4e69324c475644357542695a6b6a324e502b52477138465a2f4c2b4d615952652f2f7a5a74645a4a706e553851692f6c6e6c67707a6951307142636b784847554e7749697a2b346f424a77514137576d4f734d7a586a4a33374a43436c52794737503032382f66796f385436794d2f543148756f6877305843334e4f33457039596e5351642f634e48314739306146444551412f53755062622f776d2b514464452f54696c553472335346576a6a54466a7a7662376872736568642f4656554630477a6367574a4c6f364c372f513871567253425436556c7a5673575258554e525748496a7855466f5a6e73557a35366c79754767595667455a493538437370374b59307164634744684d33544d385276374561536b3543585153626d4d454832584f544d61484250566f68597743443469553664416944763874365833514a4436713267645571726257532f516f66352b302f51733670566f7653796d334a6d4d364f2f4d4146645965626d6878594c47475a4c38642b5a4b37597967506f6867597749452f7975783336504f4d4e66526258695869657a475a2f64685a66777136734c4d4e3239302b706e69564c336d7343535565475974746d683837486934742f46674a75676274326f316b5136744e686a547a6b616637546c636d414b4730314c764135593757745132432f4c7977444e374f36764e736433696e64394d31663157396f6754374c7467664c6f2f7a7542514f624d64557a6f764578346e502b3231524e39542f48496b486856653179327a7a4739346b44726168495858377451482b547776556f58364b757143797076744e6f495754534e4c466d7965675763435a58497533746544776d542b7859745a5966764d55743435677a6d75596d637332794935346d665a68686d6b55435533315962357836796b327069355239623253647631445553344e496b48757a6871467547344d5a7746556b796f5a304f6f7133734d6b52673659587279316a41775634457a4e523451534170345642524e46475539426e70683133383374437a486239483876724c314b737654335a5152502b5672484f3174504532587835623152474248525a2b6c704f775435753350496c704b52626e66736e79717970667458686e61615677715072304433734676715478723764455a47426e44774c752f64455242576972756d5072305569394b562b585062576a446a6f2f4642335545544e365150575545384349674c6a2b494c726a2b32586d74514750786f2b786a436c4c4c2f53434f464a5771347051634e424a544e65396d534a4d58355247492b7a667a52486d773433347843575a4b344179694d373977494169754e365636484955766c6558767a45324857737856736a7073412b6d4d736d6777653432323035635a512b662f395069316a45637737695741764c6b4441664735326c32336967674453385934646f476841633867662b49474b6d2f717731374e48476456365763396a376c4d74624f4d325362574b2f7366547367417664623152666e58774c68644e434c794744556f517764557735396c54564965473233573576457a784b61692f75453577484c4f6f4346745a45724a33636241547a573463666373513d3d
If the response is invalid, then why can the application that received the response use it? please enlighten me, sir.
This error occurs when HTTP Toolkit validates the contents of the response body as JSON. It appears because the headers say that the content is JSON (the content-type
header) but it's not: 594962502f4a30...
is not valid JSON. JSON would look like {"Hello": ["world"]}
or similar.
This instead appears to be some binary data, transmitted in Base64 format.
HTTP Toolkit is showing you the correct body, with an error warning you that it doesn't match the headers. This is a mistake in the server hosting this API. It doesn't mean the app cannot read this data though: if the app already knows what content it expects, it can just ignore the content-type header and parse the data any way it likes.
To see the 'real' data, you can select the Base64 option in the dropdown showed on the response body. Unfortunately, I think that won't help you very much, as this shows a large chunk of binary data that's not easily interpretable.
To understand what this response actually means, you will need to work out the format of that data. That may require more research or reverse engineering the app itself to understand how it parses the data or look for other clues (e.g. libraries with known network protocols such as gRPC).