Skip to content

Commit

Permalink
chore: fix the URL on swagger UI after refactoring (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
manuwell authored May 26, 2022
1 parent 60605cf commit 476cf42
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion swagger.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ const swaggerIndexTpl = `<!-- HTML for static distribution bundle build -->
window.onload = function() {
// Build a system
const ui = SwaggerUIBundle({
url: "{{.Host}}",
url: "{{.URL}}",
dom_id: '#swagger-ui',
validatorUrl: null,
defaultModelRendering: "model",
Expand Down
3 changes: 3 additions & 0 deletions swagger_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package buffaloSwagger

import (
"io/ioutil"
"net/http"
"net/http/httptest"
"testing"
Expand Down Expand Up @@ -30,6 +31,8 @@ func TestWrapHandler(t *testing.T) {
w1 := performRequest(http.MethodGet, "/swagger/index.html", router)
assert.Equal(t, http.StatusOK, w1.Code)
assert.Equal(t, w1.Header()["Content-Type"][0], "text/html; charset=utf-8")
w1BodyBytes, _ := ioutil.ReadAll(w1.Body)
assert.Contains(t, string(w1BodyBytes), "doc.json")

assert.Equal(t, http.StatusInternalServerError, performRequest(http.MethodGet, "/swagger/doc.json", router).Code)

Expand Down

0 comments on commit 476cf42

Please sign in to comment.