| @@ -3,7 +3,6 @@ package ginSwagger · 2 unmodified lines |
| 3 | 3 | import ( |
| 4 | 4 | "net/http/httptest" |
| 5 | 5 | "os" |
| 6 | | − "path/filepath" |
| 7 | 6 | "testing" |
| 8 | 7 | |
| 9 | 8 | "github.com/gin-contrib/gzip" |
| @@ -39,6 +38,7 @@ func TestWrapCustomHandler(t *testing.T) { · 29 unmodified lines |
| 39 | 38 | |
| 40 | 39 | w1 := performRequest("GET", "/index.html", router) |
| 41 | 40 | assert.Equal(t, 200, w1.Code) |
| 41 | + assert.Equal(t, w1.Header()["Content-Type"][0], "text/html; charset=utf-8") |
| 42 | 42 | |
| 43 | 43 | w2 := performRequest("GET", "/doc.json", router) |
| 44 | 44 | assert.Equal(t, 500, w2.Code) |
| @@ -50,9 +50,18 @@ func TestWrapCustomHandler(t *testing.T) { · 5 unmodified lines |
| 50 | 50 | |
| 51 | 51 | w3 := performRequest("GET", "/favicon-16x16.png", router) |
| 52 | 52 | assert.Equal(t, 200, w3.Code) |
| 53 | + assert.Equal(t, w3.Header()["Content-Type"][0], "image/png") |
| 53 | 54 | |
| 54 | | − w4 := performRequest("GET", "/notfound", router) |
| 55 | | − assert.Equal(t, 404, w4.Code) |
| 55 | + w4 := performRequest("GET", "/swagger-ui.css", router) |
| 56 | + assert.Equal(t, 200, w4.Code) |
| 57 | + assert.Equal(t, w4.Header()["Content-Type"][0], "text/css; charset=utf-8") |
| 58 | + |
| 59 | + w5 := performRequest("GET", "/swagger-ui-bundle.js", router) |
| 60 | + assert.Equal(t, 200, w5.Code) |
| 61 | + assert.Equal(t, w5.Header()["Content-Type"][0], "application/javascript") |
| 62 | + |
| 63 | + w6 := performRequest("GET", "/notfound", router) |
| 64 | + assert.Equal(t, 404, w6.Code) |
| 56 | 65 | } |
| 57 | 66 | |
| 58 | 67 | func TestDisablingWrapHandler(t *testing.T) { |
| @@ -200,7 +209,3 @@ func TestDefaultModelsExpandDepth(t *testing.T) { · 141 unmodified lines |
| 200 | 209 | configFunc(&cfg) |
| 201 | 210 | assert.Equal(t, expected, cfg.DefaultModelsExpandDepth) |
| 202 | 211 | } |
| 203 | | − |
| 204 | | −func TestDeepLinking2(t *testing.T) { |
| 205 | | − t.Logf("extension: %s", filepath.Ext("/asas/index.html")) |
| 206 | | −} |