-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Omitting host returns Internal Server Error (500) #1019
Comments
This comment solved this issue. |
Hi, i am having this problem too. How did you analyze it? |
Hi, I am also facing same problem, while accessing the swagger I am facing same error like above |
You need to import docs package in your main package. |
Thank you so much |
You need to import docs package in your main package. |
Describe the bug
When I omit
host
field in a Gin based application and try to access API documentation usinglocalhost:5000/swagger/index.html
I getFetch error Internal Server Error doc.json
. Screenshot attached.Received 500 in the application log:
As per the Swagger 2.0 specification, host and schemes can be omitted for a more dynamic association. In this case, the host and scheme used to serve the API documentation will be used for API calls. (reference)
To Reproduce
Steps to reproduce the behavior:
swag init
localhost:5000/swagger/index.html
(application is running at localhost:5000)Expected behavior
The API documentation should not return 500. The host and scheme used to serve the API documentation will be used for API calls.
Screenshots
Your swag version
v1.7.3
Your go version
1.16.5
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: