Skip to content

Should not set header after WriteHeader in example #537

@bcho

Description

@bcho

In shipping example: https://github.com/go-kit/kit/blame/master/examples/shipping/booking/transport.go#L184

encodeError may write header before setting the content-type header. From go net/http's doc:

Changing the header map after a call to WriteHeader (or Write) has no effect unless the modified headers are trailers.

Seems like the content-type header should set before the error switch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions