File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,10 @@ func main() {
23
23
``` go
24
24
package main
25
25
26
- import " github.com/quixote-liu/cors"
26
+ import (
27
+ " http"
28
+ " github.com/quixote-liu/cors"
29
+ )
27
30
28
31
func main () {
29
32
mux := http.NewServeMux ()
@@ -35,19 +38,19 @@ func main() {
35
38
36
39
37
40
type mux struct {
38
- *http.ServeMux
41
+ *http.ServeMux
39
42
}
40
43
41
44
func NewServerMux () *mux {
42
- return &mux{ServeMux: http.NewServeMux ()}
45
+ return &mux{ServeMux: http.NewServeMux ()}
43
46
}
44
47
45
48
func (m *mux ) ServeHTTP (w http .ResponseWriter , r *http .Request ) {
46
- if ok := cors.Handler (w, r); ok {
49
+ if ok := cors.Handler (w, r); ok {
47
50
w.WriteHeader (http.StatusNotFound )
48
51
return
49
52
}
50
- m.ServeMux .ServeHTTP (w, r)
53
+ m.ServeMux .ServeHTTP (w, r)
51
54
}
52
55
53
56
```
You can’t perform that action at this time.
0 commit comments