I'm building an iOS app and I need to run an HTTP request and process the response body.
The problem is that my request-url is not giving the same response body when I test it out in Postman / Alamofire (swift) versus Browser / Postman-chrome-extenstion. I need to know why!?
This is the url:
When tested in browser it gives me a google-search-result with visually similar images.
When tested in POSTMAN or in my swift code it returns a default blank google screen.
Any help much appreciated!
Try setting the User-Agent
and Accept
Headers to the same thing your browser sends. As an example Opera will send these headers:
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36 OPR/62.0.3331.99
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Adding those headers in postman allowed me to get the same result as the browser.