Skip to content

Commit c835acc

Browse files
committed
debuging
1 parent 3bffb69 commit c835acc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

reqRouter.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package grrt
66

77
import (
88
"context"
9+
"fmt"
910
"log"
1011
"net/http"
1112
"strings"
@@ -35,7 +36,11 @@ func (t ReqRouter) ServeHTTP(w http.ResponseWriter, r *http.Request) {
3536
// When there is a match, the route variables can be retrieved calling
3637
// mux.Vars(request).
3738

39+
fmt.Println("cors enabled: :", t.corsEnabled)
40+
fmt.Println("cors method: :", r.Method)
41+
3842
if t.corsEnabled && r.Method == http.MethodOptions {
43+
fmt.Println("inside if ------")
3944
t.handleCors(w)
4045
} else {
4146
path := r.URL.Path
@@ -176,6 +181,7 @@ func (t ReqRouter) SetCorsAllowedMethods(mths string) {
176181
}
177182

178183
func (t ReqRouter) handleCors(w http.ResponseWriter) {
184+
fmt.Println("inside handleCors ------")
179185
w.Header().Set(corsAllowOriginHeader, strings.Join(t.allowedOrigins, ","))
180186
w.Header().Set(corsAllowHeadersHeader, strings.Join(t.allowedHeaders, ","))
181187
w.Header().Set(corsAllowMethodsHeader, strings.Join(t.allowedMethods, ","))

0 commit comments

Comments
 (0)