Skip to content

Commit

Permalink
Ensure the headers map exists
Browse files Browse the repository at this point in the history
  • Loading branch information
punmechanic committed Nov 22, 2024
1 parent f47b7c4 commit 3732b10
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/api/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ func ServeJSON[T any](w *events.ALBTargetGroupResponse, data T) {
return
}

if w.Headers == nil {
w.Headers = make(map[string]string)
}

w.Headers["Content-Type"] = "application/json"
w.Body = string(buf)
}
Expand Down

0 comments on commit 3732b10

Please sign in to comment.