core: Add Host header to hooks event

Closes https://github.com/tus/tusd/issues/935
This commit is contained in:
Marius 2023-04-11 13:56:10 +02:00
parent dcec3df83f
commit ee9f40158e
1 changed files with 6 additions and 0 deletions

View File

@ -98,6 +98,12 @@ type HookEvent struct {
}
func newHookEvent(info FileInfo, r *http.Request) HookEvent {
// The Host header field is not present in the header map, see https://pkg.go.dev/net/http#Request:
// > For incoming requests, the Host header is promoted to the
// > Request.Host field and removed from the Header map.
// That's why we add it back manually.
r.Header.Set("Host", r.Host)
return HookEvent{
Upload: info,
HTTPRequest: HTTPRequest{