File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ package grrt
66
77import (
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
178183func (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 , "," ))
You can’t perform that action at this time.
0 commit comments