feat: support CORS by using rest.WithCors(...) (#1212)

* feat: support CORS by using rest.WithCors(...)

* chore: add comments

* refactor: lowercase unexported methods

* ci: fix lint errors
This commit is contained in:
Kevin Wan
2021-11-07 22:42:40 +08:00
committed by GitHub
parent e8efcef108
commit c28e01fed3
9 changed files with 238 additions and 145 deletions

View File

@@ -144,13 +144,13 @@ Verbose: true
var cnf RestConf
assert.Nil(t, conf.LoadConfigFromYamlBytes([]byte(yaml), &cnf))
ng := newEngine(cnf)
ng.AddRoutes(route)
ng.addRoutes(route)
ng.use(func(next http.HandlerFunc) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
next.ServeHTTP(w, r)
}
})
assert.NotNil(t, ng.StartWithRouter(mockedRouter{}))
assert.NotNil(t, ng.start(mockedRouter{}))
}
}
}