Server

Builder for the Server HTTP response header.

Usage

Source

Server()

Default header value: ""

Notes

* The default is intentionally empty to avoid leaking server details. * Callers can override this value for compatibility with legacy tooling.

Resources: - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Server - https://owasp.org/www-project-secure-headers/

Parameter Attributes

header_name: str
_value: str = HeaderDefaultValue.SERVER.value

Attributes

Name Description
header_value Retrieve the current value of the Server header.

header_value

Retrieve the current value of the Server header.

header_value: str

Returns

str: The current value of the Server header.

Methods

Name Description
clear() Reset the Server header value to its default (an empty string).
set() Set a custom value for the Server header.
value() Alias for set() (kept for feature parity with other headers).

clear()

Reset the Server header value to its default (an empty string).

Usage

Source

clear()

This method clears any custom value that has been set for the Server header and reverts it to the default, which hides server details.

Returns

Server: The current instance, allowing for method chaining.


set()

Set a custom value for the Server header.

Usage

Source

set(value)

This allows you to override the default Server header value with a custom value that will be included in HTTP responses.

Parameters

value

The custom value to set for the Server header.

Returns

Server: The current instance, allowing for method chaining.


value()

Alias for set() (kept for feature parity with other headers).

Usage

Source

value(value)