Skip to content

Commit fadf40c

Browse files
committed
Makes /healthz accept HEAD requests
1 parent 30f759b commit fadf40c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

api/api.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ func (app *api) updatedHandler(w http.ResponseWriter, r *http.Request) {
122122
}
123123

124124
func (app *api) healthHandler(w http.ResponseWriter, r *http.Request) {
125-
if r.Method != http.MethodGet {
125+
if r.Method != http.MethodHead && r.Method != http.MethodGet {
126126
app.messageResponse(w, http.StatusMethodNotAllowed, "Essa URL aceita apenas o método GET.")
127127
return
128128
}

api/api_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ func TestHealthHandler(t *testing.T) {
157157
},
158158
{
159159
http.MethodHead,
160-
http.StatusMethodNotAllowed,
161-
`{"message":"Essa URL aceita apenas o método GET."}`,
160+
http.StatusOK,
161+
"",
162162
},
163163
}
164164

0 commit comments

Comments
 (0)