added comments
This commit is contained in:
@ -2,6 +2,7 @@ package cors
|
||||
|
||||
import "net/http"
|
||||
|
||||
// HandlerForOrigin returns a CORS middleware function that sets headers based on the requested origin.
|
||||
func HandlerForOrigin(origin string) func(http.Handler) http.Handler {
|
||||
return func(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
@ -22,6 +23,7 @@ func HandlerForOrigin(origin string) func(http.Handler) http.Handler {
|
||||
}
|
||||
}
|
||||
|
||||
// DeafaultHandler: Returns a handler that allows requests from any origin by delegating to a handler that allows all origins.
|
||||
func DeafaultHandler(next http.Handler) http.Handler {
|
||||
return HandlerForOrigin("*")(next)
|
||||
}
|
||||
|
Reference in New Issue
Block a user