这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ var allowedHeaders = map[string]bool{
"vary": true,
}

// AddAllowedHeader adds a header to the list of allowed headers for the response.
// This is useful for common headers that might be sent due to middleware
// or other frameworks
func AddAllowedHeaders(name ...string) {
for _, h := range name {
allowedHeaders[strings.ToLower(h)] = true
}
}


// ContextFromRequest returns a Huma context for a request, useful for
// accessing high-level convenience functions from e.g. middleware.
func ContextFromRequest(w http.ResponseWriter, r *http.Request) Context {
Expand Down