feat: bob
This commit is contained in:
19
server/internal/interceptors/cors.go
Normal file
19
server/internal/interceptors/cors.go
Normal file
@ -0,0 +1,19 @@
|
||||
package interceptors
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
connectcors "connectrpc.com/cors"
|
||||
"github.com/rs/cors"
|
||||
)
|
||||
|
||||
// WithCORS adds CORS support to a Connect HTTP handler.
|
||||
func WithCORS(pattern string, h http.Handler) (string, http.Handler) {
|
||||
middleware := cors.New(cors.Options{
|
||||
AllowedOrigins: []string{"*"},
|
||||
AllowedMethods: connectcors.AllowedMethods(),
|
||||
AllowedHeaders: connectcors.AllowedHeaders(),
|
||||
ExposedHeaders: connectcors.ExposedHeaders(),
|
||||
})
|
||||
return pattern, middleware.Handler(h)
|
||||
}
|
Reference in New Issue
Block a user