File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 1
1
SHELL = /bin/sh
2
2
3
- VERSION =1.0.0
3
+ VERSION =1.0.1
4
4
BUILD =` git rev-parse HEAD `
5
5
6
6
LDFLAGS =-ldflags "-w -s \
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ func loggingMiddleware(next http.Handler) http.Handler {
31
31
})
32
32
}
33
33
34
- func corsMiddleware ( next http. Handler ) http. Handler {
34
+ func createCors () * cors. Cors {
35
35
return cors .New (cors.Options {
36
36
AllowCredentials : true ,
37
37
AllowedHeaders : []string {"authorization" },
@@ -59,7 +59,7 @@ func corsMiddleware(next http.Handler) http.Handler {
59
59
}
60
60
return false
61
61
},
62
- }). Handler ( next )
62
+ })
63
63
}
64
64
65
65
// Start the server
@@ -72,11 +72,12 @@ func Start(port int) {
72
72
s .routes ()
73
73
74
74
r .Use (loggingMiddleware )
75
- r .Use (corsMiddleware )
75
+
76
+ handler := createCors ().Handler (r )
76
77
77
78
listenOn := fmt .Sprintf ("127.0.0.1:%d" , port )
78
79
logger .Printf ("testtrack server listening on %s" , listenOn )
79
- logger .Fatalf ("fatal - %s" , http .ListenAndServe (listenOn , r ))
80
+ logger .Fatalf ("fatal - %s" , http .ListenAndServe (listenOn , handler ))
80
81
}
81
82
82
83
func (s * server ) handleGet (pattern string , responseFunc func () (interface {}, error )) {
You can’t perform that action at this time.
0 commit comments