Skip to content

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

@darasion

Description

@darasion

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions