Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GET request for images always get sent twice #615

Closed
jjbutler74 opened this issue Jun 18, 2014 · 21 comments
Closed

GET request for images always get sent twice #615

jjbutler74 opened this issue Jun 18, 2014 · 21 comments
Labels

Comments

@jjbutler74
Copy link

A plain GET request of an image always creates two identical request (a few milliseconds apart).

I tested this GET request:
http://www.getpostman.com/img/screens/home.png

And recorded this responds:
image

This has been observed in various scenarios and on several different machines..

@jjbutler74
Copy link
Author

This behavior is not seen in any browser. Even the Postman Collection Runner will only send the GET once.

@a85
Copy link
Contributor

a85 commented Jun 19, 2014

@jjbutler74 Will see how we can fix this. Postman makes raw XHR requests and it was just easier to let the browser render PNGs and JPEGs using the image tag after checking the Content-Type header. I think we can resolve this with the packaged app now.

@jjbutler74
Copy link
Author

Thanks for the quick response Abhinav.

@a85 a85 added the Bug label Jun 22, 2014
@fiips
Copy link

fiips commented Jul 28, 2014

Even tough this is closed and should be resolved in the packaged app. My POSTman (Version 0.10.1 (packaged)) still sends an image request twice... (with GET and with POST). Typical example: google-analytics / collect with URL parameters.

@abhijitkane
Copy link
Member

Do you have any tests or pre-request scripts for this request?

@fiips
Copy link

fiips commented Jul 29, 2014

Send this via "POST" or "GET" (doesn't matter if it is in URL parameter or directly). Please don't forget to fill in your tracking_id without brackets (don't wanted to post mine here) ;)

http://www.google-analytics.com/collect?v=1&tid=[YOUR_TRACKING_ID]&cid=TEST1234&an=TestApp&av=V1&t=timing&aid=tpu-backend%2Frest%2F1&cd=MainViewModel&sr=1920x1200&vp=1920x1200&ul=de-AT&sd=32-bits&utc=IdleTime&utv=TestIdleTime1&utt=1234

After a check on my side again, if you select "GET" and use the "URL params" button this request is only sent once. (But without the "URL params" it is still sending twice).

@rbalik
Copy link

rbalik commented Jan 23, 2015

Just wanted to chime in that I'm seeing this issue in the packaged app.
I'm doing a plain GET over HTTPS for an image/png without any url parameters.

@rbalik
Copy link

rbalik commented Jan 23, 2015

Oh and it happens with regular HTTP as well.

This is with version 1.0.6

@ehoesch
Copy link

ehoesch commented Mar 12, 2015

I have the packaged app 2.0.5. The error still occurs!!!!! Has it become a feature?

@abhijitkane
Copy link
Member

This has been fixed in the latest release. @ehoesch can you confirm?

@a85 a85 closed this as completed Jun 30, 2015
@waderyan
Copy link

waderyan commented Jul 7, 2015

I'm still seeing this.

Version 3.0.2 (packaged)
OS: mac
Architecture: x86-64
Native client architecture: x86-64

How to reproduce?
1 - Click Send in Postman

GET /img/screens/home.png HTTP/1.1
Host: www.getpostman.com
Cache-Control: no-cache

2 - Observe Http traffic

image

@rbwendt
Copy link

rbwendt commented Jul 14, 2015

I'm seeing this too. Interestingly, the second request isn't sending the same headers as the first. In my case, the second request is missing an Authorization header.

@Wilt
Copy link

Wilt commented Jul 29, 2015

Same as @rbwendt for me. Authorization header is missing totally but on top of that the Accept header is changed from image/png to image/webp,*/*;q=0.8

@anothermh
Copy link

This is definitely still happening in:

Version 3.0.13 (packaged)
OS: mac
Architecture: x86-64
Native client architecture: x86-64

Can we please have this issue reopened?

@abhijitkane
Copy link
Member

@anothermh @Wilt
I'm sending a GET request to http://www.getpostman.com/img/logo.png, (interceptor disabled), and seeing only one request (tried with https too) in the server logs. Are there any specific images you see this for? Also, how are you determining that the request is sent twice?

This happens for pdf files because Postman has to re-send the request with xhr.responsetype set to arraybuffer, but I'm not sure why it should be happening for images.

@anothermh
Copy link

I am using a Rails controller to generate and render an image to the client. The Rails controller uses send_data to render to the client. When I request this endpoint with Postman it renders twice:

Started GET "/b7934fb1ad8f1ff106dec2bb8917a603b0dff99a/4a438eb2eb7ff3d86e784c96bef5a3b9e393cc29/image.jpg" for ::1 at 2015-09-05 12:08:36 -0700
Processing by ExampleController#send_image as JPEG
  Parameters: {"hash_one"=>"b7934fb1ad8f1ff106dec2bb8917a603b0dff99a", "hash_two"=>"4a438eb2eb7ff3d86e784c96bef5a3b9e393cc29", "image_name"=>"image"}
  Rendered text template (0.2ms)
Sent data image.jpg (11.5ms)
Completed 200 OK in 12737ms (Views: 11.3ms | ActiveRecord: 4725.1ms)


Started GET "/b7934fb1ad8f1ff106dec2bb8917a603b0dff99a/4a438eb2eb7ff3d86e784c96bef5a3b9e393cc29/image.jpg" for ::1 at 2015-09-05 12:08:49 -0700
Processing by ExampleController#send_image as JPEG
  Parameters: {"hash_one"=>"b7934fb1ad8f1ff106dec2bb8917a603b0dff99a", "hash_two"=>"4a438eb2eb7ff3d86e784c96bef5a3b9e393cc29", "image_name"=>"image"}
  Rendered text template (0.3ms)
Sent data image.jpg (0.8ms)
Completed 200 OK in 2136ms (Views: 0.7ms | ActiveRecord: 1648.1ms)

When I make the same request using curl or a browser like Chrome, Firefox, or Safari, the controller and actions are only fired once. The logs show only a single inbound request (omitting the log since it's obviously only one request in the log when fired by browser).

Here are the headers returned when I view the response in Postman (after a double render):

Cache-Control → no-cache, no-store
Content-Disposition → attachment; filename="image.jpg"
Content-Length → 11145
Content-Transfer-Encoding → binary
Content-Type → image/jpg
Expires → Sat, 26 Jul 1997 05:00:00 GMT
Pragma → no-cache
X-Content-Type-Options → nosniff
X-Frame-Options → SAMEORIGIN
X-Request-Id → 18e60be8-59e0-4ae1-bfa6-e6e8e3e624ed
X-Runtime → 2.325739
X-XSS-Protection → 1; mode=block

Here are the headers returned when I view the response in curl --head -XGET (which works normally and does only a single render):

HTTP/1.1 200 OK
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Cache-Control: no-cache, no-store
Pragma: no-cache
Content-Type: image/jpg
Expires: Sat, 26 Jul 1997 05:00:00 GMT
Content-Disposition: attachment; filename="image.jpg"
Content-Transfer-Encoding: binary
X-Request-Id: ee9e77ce-b2e3-41e6-97e2-a9e2b60cae79
X-Runtime: 2.261185
Content-Length: 11145

@anothermh
Copy link

One thing I missed was disabling Interceptor, which has stopped the double render. Can you help me understand why that causes that issue?

@abhijitkane
Copy link
Member

The Interceptor seems to be resending the request with responsetype=arraybuffer if it's an image. There doesn't seem to be a need to do that, since Postman is the one that renders the response. We've pushed a fix - can you update to version 0.2.12 of the Interceptor (chrome:/extensions, Developer Mode > Update extensions now) and check?

@anothermh
Copy link

I can confirm that the problem has been resolved in 0.2.12 of Interceptor. The GET request is only seen once in the server logs. Thank you for quickly resolving this.

@ajsjunior
Copy link

The same problem is happening with media type application/pdf.
How to fix this?

@novabe
Copy link

novabe commented Feb 3, 2017

Also Seeing this with PDF, version:
4.9.2
win / x86-32
Chrome 56.0.2924.76

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests