gravityblast/traffic

Multipe calls to WriteHeader ?

therealbill opened this issue · 2 comments

I have a handler which calls WriteHeader(int) on a traffic.ResponseWriter. However I get in the log:

2014/08/21 13:15:11 http: multiple response.WriteHeader calls

I've confirmed the handler itself only calls it once, and looking at the implementation in traffic I don't see why the error is happening. Nothing seems to break but the "error" is logged.

Hi @therealbill , can you post an example in a gist so that I can work on the same code you have please?

I don't have that message with the following example:

package main

import "github.com/pilu/traffic"

func Root(w traffic.ResponseWriter, r *traffic.Request) {
    w.WriteHeader(200)
    w.WriteText("Hello")
}

func main() {
    r := traffic.New()
    r.Get("/", Root)
    r.Run()
}

Do you have any before filters or middlewares?