chore: fix deprecated usages (#1871)

* add conf documents

* chore: use {} instead of () for environment variables

* chore: fix deprecated usages

* chore: fix unstable tests

* chore: show stack on github actions
This commit is contained in:
Kevin Wan
2022-05-06 15:13:46 +08:00
committed by GitHub
parent 469e62067c
commit d0a59b13a6
4 changed files with 11 additions and 16 deletions

View File

@@ -146,7 +146,7 @@ Verbose: true
for _, yaml := range yamls {
for _, route := range routes {
var cnf RestConf
assert.Nil(t, conf.LoadConfigFromYamlBytes([]byte(yaml), &cnf))
assert.Nil(t, conf.LoadFromYamlBytes([]byte(yaml), &cnf))
ng := newEngine(cnf)
ng.addRoutes(route)
ng.use(func(next http.HandlerFunc) http.HandlerFunc {
@@ -300,15 +300,15 @@ func TestEngine_notFoundHandlerNotNilWriteHeader(t *testing.T) {
type mockedRouter struct{}
func (m mockedRouter) ServeHTTP(writer http.ResponseWriter, request *http.Request) {
func (m mockedRouter) ServeHTTP(_ http.ResponseWriter, _ *http.Request) {
}
func (m mockedRouter) Handle(method, path string, handler http.Handler) error {
func (m mockedRouter) Handle(_, _ string, _ http.Handler) error {
return errors.New("foo")
}
func (m mockedRouter) SetNotFoundHandler(handler http.Handler) {
func (m mockedRouter) SetNotFoundHandler(_ http.Handler) {
}
func (m mockedRouter) SetNotAllowedHandler(handler http.Handler) {
func (m mockedRouter) SetNotAllowedHandler(_ http.Handler) {
}