Skip to content

Commit 50e091c

Browse files
author
ubuntu
committed
opt
1 parent 8dc9b36 commit 50e091c

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ func main() {
2323
```go
2424
package main
2525

26-
import "github.com/quixote-liu/cors"
26+
import (
27+
"http"
28+
"github.com/quixote-liu/cors"
29+
)
2730

2831
func main() {
2932
mux := http.NewServeMux()
@@ -35,19 +38,19 @@ func main() {
3538

3639

3740
type mux struct {
38-
*http.ServeMux
41+
*http.ServeMux
3942
}
4043

4144
func NewServerMux() *mux {
42-
return &mux{ServeMux: http.NewServeMux()}
45+
return &mux{ServeMux: http.NewServeMux()}
4346
}
4447

4548
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 {
4750
w.WriteHeader(http.StatusNotFound)
4851
return
4952
}
50-
m.ServeMux.ServeHTTP(w, r)
53+
m.ServeMux.ServeHTTP(w, r)
5154
}
5255

5356
```

0 commit comments

Comments
 (0)