Skip to content

Commit

Permalink
update rest library for proper 404 content type
Browse files Browse the repository at this point in the history
  • Loading branch information
umputun committed Jan 6, 2022
1 parent a963516 commit e2a40bc
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
14 changes: 14 additions & 0 deletions app/proxy/proxy_test.go
Expand Up @@ -282,6 +282,20 @@ func TestHttp_DoWithAssetsCustom404(t *testing.T) {
body, err := io.ReadAll(resp.Body)
require.NoError(t, err)
assert.Equal(t, "not found! blah blah blah\nthere is no spoon", string(body))
t.Logf("%+v", resp.Header)
assert.Equal(t, "text/html; charset=utf-8", resp.Header.Get("Content-Type"))
}

{
resp, err := client.Get("http://localhost:" + strconv.Itoa(port) + "/static/bad2.html")
require.NoError(t, err)
defer resp.Body.Close()
assert.Equal(t, http.StatusNotFound, resp.StatusCode)
body, err := io.ReadAll(resp.Body)
require.NoError(t, err)
assert.Equal(t, "not found! blah blah blah\nthere is no spoon", string(body))
t.Logf("%+v", resp.Header)
assert.Equal(t, "text/html; charset=utf-8", resp.Header.Get("Content-Type"))
}
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -8,7 +8,7 @@ require (
github.com/felixge/httpsnoop v1.0.2 // indirect
github.com/go-pkgz/lgr v0.10.4
github.com/go-pkgz/repeater v1.1.3
github.com/go-pkgz/rest v1.12.0
github.com/go-pkgz/rest v1.12.1
github.com/golang/protobuf v1.5.2 // indirect
github.com/gorilla/handlers v1.5.1
github.com/prometheus/client_golang v1.11.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Expand Up @@ -83,6 +83,8 @@ github.com/go-pkgz/rest v1.11.0 h1:Z//qgmM0NhBYfhXYEP/aJtDVLK5XlJGxqcb4sHFNN0E=
github.com/go-pkgz/rest v1.11.0/go.mod h1:wZ/dGipZUaF9to0vIQl7PwDHgWQDB0jsrFg1xnAKLDw=
github.com/go-pkgz/rest v1.12.0 h1:zabW9ZLZzSyGsrTtEgzGUhGCfqcPnCr5nhfrap96mU4=
github.com/go-pkgz/rest v1.12.0/go.mod h1:KUWAqbDteYGS/CiXftomQsKjtEOifXsJ36Ka0skYbmk=
github.com/go-pkgz/rest v1.12.1 h1:s5EoHrHknaioHT/mGWaRMDk9GH2U/FmGMWQsCMj6III=
github.com/go-pkgz/rest v1.12.1/go.mod h1:KUWAqbDteYGS/CiXftomQsKjtEOifXsJ36Ka0skYbmk=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
Expand Down
1 change: 1 addition & 0 deletions vendor/github.com/go-pkgz/rest/file_server.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Expand Up @@ -26,7 +26,7 @@ github.com/go-pkgz/lgr
## explicit; go 1.12
github.com/go-pkgz/repeater
github.com/go-pkgz/repeater/strategy
# github.com/go-pkgz/rest v1.12.0
# github.com/go-pkgz/rest v1.12.1
## explicit; go 1.16
github.com/go-pkgz/rest
github.com/go-pkgz/rest/logger
Expand Down

0 comments on commit e2a40bc

Please sign in to comment.