Skip to content

Commit

Permalink
gofr-dev#1130:added check to ignore already set headers
Browse files Browse the repository at this point in the history
  • Loading branch information
rigved-telang committed Oct 31, 2024
1 parent d399bf2 commit b761c3f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/gofr/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// **Handle Custom Headers** if `result` is a `Response`.
if resp, ok := result.(response.Response); ok {
for key, value := range resp.Headers {
w.Header().Set(key, value)
if w.Header().Get(key) == "" {
w.Header().Set(key, value)
}
}
result = resp.Data
}
Expand Down

0 comments on commit b761c3f

Please sign in to comment.