Add EnableNormalizing to RequestHeader and ResponseHeader

This commit is contained in:
Erik Dubbelboer
2020-08-16 09:18:05 +02:00
parent cc8ba4b5a3
commit a995d43d9c
+32
View File
@@ -585,6 +585,22 @@ func (h *RequestHeader) DisableNormalizing() {
h.disableNormalizing = true
}
// EnableNormalizing enables header names' normalization.
//
// Header names are normalized by uppercasing the first letter and
// all the first letters following dashes, while lowercasing all
// the other letters.
// Examples:
//
// * CONNECTION -> Connection
// * conteNT-tYPE -> Content-Type
// * foo-bar-baz -> Foo-Bar-Baz
//
// This is enabled by default unless disabled using DisableNormalizing()
func (h *RequestHeader) EnableNormalizing() {
h.disableNormalizing = false
}
// DisableNormalizing disables header names' normalization.
//
// By default all the header names are normalized by uppercasing
@@ -601,6 +617,22 @@ func (h *ResponseHeader) DisableNormalizing() {
h.disableNormalizing = true
}
// EnableNormalizing enables header names' normalization.
//
// Header names are normalized by uppercasing the first letter and
// all the first letters following dashes, while lowercasing all
// the other letters.
// Examples:
//
// * CONNECTION -> Connection
// * conteNT-tYPE -> Content-Type
// * foo-bar-baz -> Foo-Bar-Baz
//
// This is enabled by default unless disabled using DisableNormalizing()
func (h *ResponseHeader) EnableNormalizing() {
h.disableNormalizing = false
}
// SetNoDefaultContentType allows you to control if a default Content-Type header will be set (false) or not (true).
func (h *ResponseHeader) SetNoDefaultContentType(noDefaultContentType bool) {
h.noDefaultContentType = noDefaultContentType