-
Notifications
You must be signed in to change notification settings - Fork 9k
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
Downloading a file generates a second GET request [without headers] #489
Downloading a file generates a second GET request [without headers] #489
Comments
Hi, are you sure the second request is a GET? Maybe it's an options? I need some more info for this. Can you share your JSON description? |
Hi Tony, Yes, I get two GET requests. Here is what I get when invoking my REST api via Swagger: [debug] application - request /auth/users/5392238c1e04001e04b384b4/avatar authorized for user 5392238c1e04001e04b384b4 ... and here is what I get when invoking my REST api via curl: [debug] application - request /auth/users/5392238c1e04001e04b384b4/avatar authorized for user 5392238c1e04001e04b384b4 As you can see, curl invokes the API only once with the correct authorization token and everything works fine. Instead, Swagger invokes the API twice: the first GET request is correct and contains the right authorization token, while in the second GET request the token is gone and as a result the file is not downloaded. I hope that helps, |
OK--if you can send the JSON for that API I can help sort it out. If you don't want to post it here, you can email it to me. |
OK, just emailed more info. Tx. |
try again. Just did an update of swagger-ui |
Hi Tony, Replacing swagger.js produces the following error when sending a POST For request 'POST /auth/users/credentials' [Expecting text/json or Talk 2 u soon, On 02.08.2014 02:28, Tony Tam wrote:
Giuseppe Greco_|_Founder |
Hi j3d, I messed it up yesterday and pushed a fix just a few minutes ago. Can you please update to swagger-ui 2.0.21 and swagger-js 2.0.36? |
Hi Tony, I've just updated my Swagger UI distro... but it doesn't work. GET Since no error message is generated I'm unable to provide you with more Talk 2 u soon, On 03.08.2014 00:59, Tony Tam wrote:
|
Just to let you know I tested the latest version... and the problem is still here (it works with CURL). Let me know if I could help somehow ;-) |
Did some additional tests... and the last version ALWAYS generates two requests, regardless of the request type (GET, PATCH, ...). |
I don't see this. Try from here: http://petstore.swagger.wordnik.com/ Do you see multiple requrests? You sure you're not seeing the OPTIONS request first? |
Hi Tony, Sorry for my delay... but I wanted to be sure and so I did some more
So when I said that GET, PATCH, ... ALWAYS generate a second HTTP Talk 2 u soon, On 28.08.2014 07:40, Tony Tam wrote:
Giuseppe Greco_|_Founder |
OK, it is true that swagger is not sending an empty JSON for any requests automatically. So if you issue a PATCH without any content, it is not putting |
I just did a small change in the swagger-ui source so that I no longer the the "invalid JSON" error: if (obj.body == null && obj.method != "GET") obj.body = "{}"; This works for me ;-) What is still not working are GET requests to download files... they always generate two GET |
I think this is a valid solution, it belongs in swagger-js. I still cannot reproduce the double download request. If you have a service up, a sample, or anything like that, would be happy to help sort this out. |
Give me 5 minutes... if you provide me with your private email I'll j3d On 06.09.2014 17:57, Tony Tam wrote:
Giuseppe Greco_|_Founder |
sure--i'm stepping away from the computer for about 2 hours but can help when back. [email protected] |
I'm unable to reproduce this. If you can re-test with M1, let's reopen this. |
Just tried... and I still get two GET requests (as I already told you, On 01.02.2015 05:51, Tony Tam wrote:
|
Is your spec publicly available? If you want to share it in private, feel free to send an email with the details (mail available on profile). |
I'm having similar issue. In Chrome browser: You'll see that SwaggerUI indicated there is no response from the server. ..but then it works if you open your web/javascript console. ..and then when I try it in Firefox, it works fine. I notice two requests are being sent to s3 for the image. Does anyone know why this would be happening? --jle |
In the following Controller, method getAvatar returns the image of the user's avatar:
The code above forks fine as long as I ignore security. For instance, SecuredAction is a custom Action that manages authorization using Jwt (Json Web Token). Each request needs to have a valid JWT in the AUTHORIZATION header to get authorized... and also this mechanism works fine. The problem is that in case of file download, the method (in this case getAvatar) get invoked twice: the first GET request contains the token, while the second GET request doesn't.
I've tried my REST API with curl: it works fine and DOESN'T generate a second GET as Swagger does.
The text was updated successfully, but these errors were encountered: