2021-09-12 18:39:09 -04:00
|
|
|
package handler
|
2021-01-24 04:48:07 -05:00
|
|
|
|
|
|
|
|
import "net/http"
|
|
|
|
|
|
2021-09-12 18:39:09 -04:00
|
|
|
func DevelopmentCORS(next http.Handler) http.Handler {
|
2021-01-24 04:48:07 -05:00
|
|
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
2022-01-02 18:29:34 -05:00
|
|
|
w.Header().Set("Access-Control-Allow-Credentials", "true")
|
2021-01-24 04:48:07 -05:00
|
|
|
w.Header().Set("Access-Control-Allow-Origin", "http://localhost:8081")
|
2022-01-02 18:29:34 -05:00
|
|
|
if r.Method == "OPTIONS" {
|
|
|
|
|
return
|
|
|
|
|
}
|
2021-01-24 04:48:07 -05:00
|
|
|
next.ServeHTTP(w, r)
|
|
|
|
|
})
|
|
|
|
|
}
|