Skip to content

Commit

Permalink
fix: set http status code after defining response headers
Browse files Browse the repository at this point in the history
  • Loading branch information
vinyguedess committed Mar 10, 2022
1 parent 60d744b commit 6ddd27c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ func Handler(handler EasyHandler) MuxHandler {
response := NewResponse(responseWriter)

receivedResponse := handler(request, response)
responseWriter.WriteHeader(receivedResponse.GetStatus())
for key, value := range receivedResponse.GetHeaders() {
responseWriter.Header().Set(key, value)
}
responseWriter.WriteHeader(receivedResponse.GetStatus())
responseWriter.Write([]byte(receivedResponse.GetData()))
}
}

0 comments on commit 6ddd27c

Please sign in to comment.