Skip to content

Possible false response code #36

@sanketplus

Description

@sanketplus

if we look at https://github.com/thoas/stats/blob/master/recorder.go#L39 and take following scenario:

func (r *recorderResponseWriter) WriteHeader(code int) {
	r.written = true
	r.ResponseWriter.WriteHeader(code)
	r.status = code
}
  1. We write header 200. :: r.status=200, r.ResponseWriter.status=200
  2. We write header 200. :: r.status=300, r.ResponseWriter.status=200
    in step 2 internal response writer ignores new status code.

ref:

if I understood the issue correctly and if it really is a genuine issue, happy to make a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions