jazzcat
jazzcat

Reputation: 4441

How to sniff HTTP response headers in Chrome? for "attachment" content?

Usually I'm able to sniff my HTTP requests using Chrome Dev Tools - network tab.

But it's not happening for download-files (i.e. when Content-Dsiplosition is set to Attachment;filename=xxx) - then Chrome just downloads the file and nothing is shown on the network tab.

How do I see those? I mean, in Chrome, without any 3rd party tools like PostMan.

PS. I need to see the headers my server sends, there's some debugging info I need.

Upvotes: 26

Views: 16371

Answers (4)

Yepeekai
Yepeekai

Reputation: 2723

You can view them in FireFox: F12 then Network tab

Upvotes: 4

Ryszard Perkowski
Ryszard Perkowski

Reputation: 656

I think the best solution here is to use Postman Interceptor which will provide Chrome cookies. So just follow http://blog.getpostman.com/2014/11/28/using-the-interceptor-to-read-and-write-cookies/ and then paste that download link in Postman to see request and response details.

Upvotes: 0

Hay
Hay

Reputation: 2281

When I try to paste an URL pointing to a downloadable file, directly into the browser address, it doesn't show anything on the network tab.

However, I've found a workaround that suits my use case. Create an .html file anywhere, and just create a link to that attachment (an alternative is to just open about:blank in the browser and edit the HTML in place).

<a href="https://example.com/example.ambiguous.file">download</a>

Then open that .html file and click on the link.

This causes the network tab to display the file you're trying to download, and so the headers.

In my case I was able to troubleshoot how the Content-Disposition headers was never sent to specific browsers.


EDIT (2017-11):

If this doesn't work with recent versions of Chrome, try putting it in an image tag. The objective is to sniff the HTTP response headers, not the content.

<img src="https://example.com/example.ambiguous.file">download</img>

Upvotes: 14

Azurlake
Azurlake

Reputation: 632

You can view them from the Headers tab.

The response body itself is the file being downloaded and you will not be able to see it from the Response tab, but I can see the response headers from the Headers tab, check the picture:

enter image description here

Upvotes: -1

Related Questions