Skip to content

Commit

Permalink
default http content type (GO-7710) (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
jfallis authored May 16, 2023
1 parent f4335d6 commit 840bf33
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions http.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func LambdaAdapter(l LambdaHandler) func(http.ResponseWriter, *http.Request) {
}
}

resp.Headers["Content-Type"] = "application/json"
w.WriteHeader(resp.StatusCode)
for k, v := range resp.Headers {
w.Header().Set(k, v)
Expand Down
2 changes: 1 addition & 1 deletion http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestLambdaAdapter(t *testing.T) {
g8.LambdaAdapter(l)(w, r)

assert.Equal(t, http.StatusOK, w.Code)
assert.Equal(t, "text/plain", w.Header().Get("Content-Type"))
assert.Equal(t, "application/json", w.Header().Get("Content-Type"))
assert.Equal(t, "cookie1,cookie2", w.Header().Get("Set-Cookie"))
assert.Equal(t, "success", w.Body.String())
}
Expand Down

0 comments on commit 840bf33

Please sign in to comment.