ogen icon indicating copy to clipboard operation
ogen copied to clipboard

Bug: case sensitive handling of HTTP Header

Open AndreasBergmeier6176 opened this issue 1 year ago • 2 comments

What version of ogen are you using?

$ go list -m github.com/ogen-go/ogen

github.com/ogen-go/ogen v1.3.0

Can this issue be reproduced with the latest version?

Yes

What did you do?

Generate bindings. As a result the following was generated:

	if _, ok := r.Header["Content-Type"]; !ok && r.ContentLength == 0 {
		return req, close, nil
	}
	ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
	if err != nil {
		return req, close, errors.Wrap(err, "parse media type")
	}

What did you expect to see?

Would expect r.Headers to only be accessed via Get due to case insensitivity.

What did you see instead?

Direct access of r.Header["Content-Type"] which does not handle insensitivity.

AndreasBergmeier6176 avatar Aug 22 '24 08:08 AndreasBergmeier6176

Incoming headers are canonicalized by Go http server, not sure if it is really a problem.

ghost avatar Aug 22 '24 08:08 ghost

Are you sure this cannot be a problem when writing tests against the API?

AndreasBergmeier6176 avatar Aug 22 '24 09:08 AndreasBergmeier6176