Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http: multiple response.WriteHeader calls when using fault.Recovery #48

Open
darasion opened this issue Jan 24, 2018 · 0 comments
Open

Comments

@darasion
Copy link

test code is:

package main

import (
    "github.com/go-ozzo/ozzo-routing"
    "github.com/go-ozzo/ozzo-routing/fault"
    "log"
    "net/http"
)

func main() {
    router := routing.New()
    router.Use(
        fault.Recovery(log.Printf, func(c *routing.Context, err error) error {
            c.Write(err)
            return nil 
        }), 
    )   
    http.Handle("/", router)
    http.ListenAndServe(":8123", nil)
}

on error occurred, it will log an additional message: http: multiple response.WriteHeader calls

2018/01/24 12:08:54 Not Found
2018/01/24 12:08:54 http: multiple response.WriteHeader calls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant