Merge branch 'pre-get-hook' of github.com:benitogf/tusd into pre-get-hook

This commit is contained in:
benitogf 2021-10-18 15:13:06 +08:00
commit c293c54417
1 changed files with 7 additions and 0 deletions

View File

@ -751,6 +751,13 @@ func (handler *UnroutedHandler) GetFile(w http.ResponseWriter, r *http.Request)
return return
} }
if handler.config.PreGetCallback != nil {
if err := handler.config.PreGetCallback(newHookEvent(info, r)); err != nil {
handler.sendError(w, r, err)
return
}
}
// Set headers before sending responses // Set headers before sending responses
w.Header().Set("Content-Length", strconv.FormatInt(info.Offset, 10)) w.Header().Set("Content-Length", strconv.FormatInt(info.Offset, 10))