Performs the low-level validations on the provided value that are done when res.setHeader(name, value) is called.
Passing illegal value as value will result in a TypeError being thrown.
Undefined value error is identified by code: 'ERR_HTTP_INVALID_HEADER_VALUE'.
Invalid value character error is identified by code: 'ERR_INVALID_CHAR'.
It is not necessary to use this method before passing headers to an HTTP request
or response. The HTTP module will automatically validate such headers.
Performs the low-level validations on the provided
value
that are done whenres.setHeader(name, value)
is called.Passing illegal value as
value
will result in aTypeError
being thrown.code: 'ERR_HTTP_INVALID_HEADER_VALUE'
.code: 'ERR_INVALID_CHAR'
.It is not necessary to use this method before passing headers to an HTTP request or response. The HTTP module will automatically validate such headers.
Examples: