XContentTypeOptions
Builder for the X-Content-Type-Options HTTP header.
Usage
XContentTypeOptions()Default header value: nosniff
Notes
* The only standardized directive is nosniff; other values are allowed but discouraged.
Resources: - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options - https://owasp.org/www-project-secure-headers/#x-content-type-options
Parameter Attributes
header_name: str_value: str = HeaderDefaultValue.X_CONTENT_TYPE_OPTIONS.value
Attributes
| Name | Description |
|---|---|
| header_value |
Return the current X-Content-Type-Options header value.
|
header_value
Return the current X-Content-Type-Options header value.
header_value: str
Returns
The current X-Content-Type-Options header value as a string.
Methods
| Name | Description |
|---|---|
| clear() |
Reset the X-Content-Type-Options header to its default value.
|
| nosniff() |
Set the X-Content-Type-Options header to nosniff.
|
| set() |
Set a custom value for the X-Content-Type-Options header.
|
| value() | Alias for set() to match other headers. |
clear()
Reset the X-Content-Type-Options header to its default value.
Usage
clear()Returns
The XContentTypeOptions instance for method chaining.
nosniff()
Set the X-Content-Type-Options header to nosniff.
Usage
nosniff()This value tells the browser to block requests for certain content types and prevents MIME-sniffing attacks.
Resources: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options
Returns
The XContentTypeOptions instance for method chaining.
set()
Set a custom value for the X-Content-Type-Options header.
Usage
set(value)Parameters
value-
The custom header value.
Returns
The XContentTypeOptions instance for method chaining.
value()
Alias for set() to match other headers.
Usage
value(value)