AK
Size: a a a
AK
АД
MA
MA
package cors
import "net/http"
// Check CORS request
func CheckCORS(handler http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
(w).Header().Set("Access-Control-Allow-Origin", "*")
(w).Header().Set("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE")
(w).Header().Set("Access-Control-Allow-Headers", "Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, X-Token, Authorization")
if r.Method == "OPTIONS" {
return
}
handler.ServeHTTP(w, r)
})
}
MA
DK
for ..... {
некая
логика
}н
package cors
import "net/http"
// Check CORS request
func CheckCORS(handler http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
(w).Header().Set("Access-Control-Allow-Origin", "*")
(w).Header().Set("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE")
(w).Header().Set("Access-Control-Allow-Headers", "Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, X-Token, Authorization")
if r.Method == "OPTIONS" {
return
}
handler.ServeHTTP(w, r)
})
}
DK
for time.Now().Before(deadlineTime){ ... }IS
A
IS
IS
KO
DP
AC
LO