xml - Known JSON file looks different in each browser -
it's not programming question, interesting developers.
today came across question user asking parsing json data in c#. nothing new, gave link json file:
the page not available anymore!.
if browse above link in google chrome can notice file shown xml. checked url in edge , showed me json file.
google chrome
edge
i'm bit confused. why google chrome shows json file xml?
that's because chrome sending different data in accept http header:
chrome's request:
get http://sapi.confirmtkt.com/api/platform/hotel/gethotels?city=bangalore&checkindate=08-01-2016&checkoutdate=09-01-2016&adults=2&rooms=1&children=0&childrenages= http/1.1 host: sapi.confirmtkt.com connection: keep-alive cache-control: max-age=0 accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 upgrade-insecure-requests: 1 user-agent: mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, gecko) chrome/48.0.2564.48 safari/537.36 accept-encoding: gzip, deflate, sdch accept-language: es,en;q=0.8 edge's request:
get http://sapi.confirmtkt.com/api/platform/hotel/gethotels?city=bangalore&checkindate=08-01-2016&checkoutdate=09-01-2016&adults=2&rooms=1&children=0&childrenages= http/1.1 accept: text/html, application/xhtml+xml, image/jxr, */* accept-language: es-cl,es;q=0.8,en-us;q=0.5,en;q=0.3 user-agent: mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, gecko) chrome/46.0.2486.0 safari/537.36 edge/13.10586 accept-encoding: gzip, deflate host: sapi.confirmtkt.com connection: keep-alive you can see how chrome accepting application/xml;q=0.9 in accept header. so, fired fiddler , intercepted request, deleted part of accept header , server replies json rather xml.
tl;dr: server giving 2 different responses same url because of accept header.



Comments
Post a Comment