twskj / pretty-swag

Pretty UI for Swagger spec
MIT License
122 stars 20 forks source link

'Try it out' API calls using HTTP, not HTTPS #63

Closed JeremyCraigMartinez closed 5 years ago

JeremyCraigMartinez commented 5 years ago

The requests against the API for trying out an endpoint is not reading from schemes in the swagger.json. I'm getting a GET against an http:// even though my swagger definition is

{
  "swagger": "2.0",
  "info": {
    "version": "2019-03-04T21:51:15Z",
    "title": "API"
  },
  "host": "api.my-domain.com",
  "schemes": [
    "https"
  ],
...
twskj commented 5 years ago

Thanks for reporting :) I'll have a look in the evening.

JeremyCraigMartinez commented 5 years ago

Awesome, thanks! I also noticed the same issue with the pet store docs

This is a Mixed Content call. Many browsers will block this by default.

twskj commented 5 years ago

That generally means that when the document is served under https but trying to make an ajax call out to http endpoint usually get blocked by default. It's an expected behavior in Chrome and Firefox as far as I know

twskj commented 5 years ago

It's a bug having only https should not show http option. I'll make some adjustment for this.

twskj commented 5 years ago

I rolled out the fix in 0.2.3. Now it should respect scheme from the input and show only what available. Check it out

twskj commented 5 years ago

I am closing this. If you still have problem, feel free to reopen.