with
Adds a key-value pair to this header and returns the header for method chaining.
This method provides a fluent API for setting header values, allowing multiple header modifications to be chained together. Internally, this delegates to the put method, which will check the read-only status before making changes.
Return
This header instance to support method chaining
Parameters
The header key to set (must not be null or empty)
The header value to associate with the key (must not be null)
Throws
if the header is read-only
Samples
Adds all key-value pairs from the provided map to this header and returns the header for method chaining.
This method provides a fluent API for bulk header modifications, allowing multiple header fields to be set at once. Internally, this delegates to the putAll method, which will check the read-only status before making changes.
Return
This header instance to support method chaining
Parameters
A map containing key-value pairs to add to this header (must not be null)
Throws
if the header is read-only