Add response headers to APIRequest

This commit is contained in:
Daniel 2023-09-05 12:50:42 +02:00
parent f2208faf8c
commit 82ed043721
2 changed files with 6 additions and 0 deletions

View file

@ -436,6 +436,9 @@ func (e *Endpoint) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}
// Add response headers to request struct so that the endpoint can work with them.
apiRequest.ResponseHeader = w.Header()
// Execute action function and get response data
var responseData []byte
var err error

View file

@ -26,6 +26,9 @@ type Request struct {
// AuthToken is the request-side authentication token assigned.
AuthToken *AuthToken
// ResponseHeader holds the response header.
ResponseHeader http.Header
// HandlerCache can be used by handlers to cache data between handlers within a request.
HandlerCache interface{}
}