Skip to content
New issue

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

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

Already on GitHub? # to your account

missing host still not working #2904

Closed
fehguy opened this issue Apr 11, 2017 · 5 comments · Fixed by #2912
Closed

missing host still not working #2904

fehguy opened this issue Apr 11, 2017 · 5 comments · Fixed by #2912

Comments

@fehguy
Copy link
Contributor

fehguy commented Apr 11, 2017

This should have been addressed but as of now, I'm not seeing proper behavior.

Using this URL against the petstore, which is latest master:

http://petstore.swagger.io/?url=https://generator.swagger.io/api/swagger.json

I see two issues.

First, the CURL url is incorrect. Note the protocol should be https:

image

Next, the request never actually succeeds. Note the URL in the network console:

image

@Bert-R
Copy link

Bert-R commented Apr 12, 2017

I see slightly different behavior with 3.0.5. The good news is that it works for me, even with HTTPS. The only issue that I see is that the displayed curl command is wrong.

You can try it out yourself here: https://beta.prd.yona.nu/swagger-ui/index.html. If you just take the first operation and provide a nonsense user ID and password, you'll get an error, which indicates that request properly reaches the server.

The curl command is wrong:

curl -X POST "http://users/asdf/pinResetRequest/request" -H  "accept: application/json" -H  "content-type: application/json" -H  "Yona-Password: asdf"

That should have been:

curl -X POST "https://beta.prd.yona.nu/users/asdf/pinResetRequest/request" -H  "accept: application/json" -H  "content-type: application/json" -H  "Yona-Password: asdf"

So: HTTPS and the right host name.

The Swagger spec is referenced as ../swagger/swagger-spec.yaml from index.html.

@shockey
Copy link
Contributor

shockey commented Apr 14, 2017

Scheme problem is fixed: if no scheme is defined in the spec, we will try to extract a valid scheme from the URL the spec is loaded from (doesn't affect relative-path spec URLs) before falling back to http as a last resort. This should fix both Try-It-Out and the curl display.

For the second part, looks like baseUrl in swagger-js is being called twice when Execute is clicked- it's called once with the contextUrl, and once without. The actual request that fires is the one without, which breaks the functionality. Investigating.

@shockey
Copy link
Contributor

shockey commented Apr 14, 2017

Found it- fix incoming.

@larshp
Copy link

larshp commented Apr 15, 2017

thanks, now it works for me 👍

@Bert-R
Copy link

Bert-R commented Apr 15, 2017

The curl command is now right but unfortunately HTTPS doesn't work anymore.

I've logged #2919 for this.

@lock lock bot locked and limited conversation to collaborators Jul 3, 2019
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants