mirror of
https://github.com/fafhrd91/actix-web
synced 2025-06-25 06:39:22 +02:00
Support to set header names of ClientRequest
as Camel-Case (#713)
* Support to set header names of `ClientRequest` as Camel-Case This is the case for supporting to request for servers which don't perfectly implement the `RFC 7230`. It is important for an app which uses `ClientRequest` as core part. * Add field `upper_camel_case_headers` to `ClientRequest`. * Add function `set_upper_camel_case_headers` to `ClientRequest` and `ClientRequestBuilder` to set field `upper_camel_case_headers`. * Add trait `client::writer::UpperCamelCaseHeader` for `http::header::HeaderName`, let it can be converted to Camel-Case then writed to buffer. * Add test `test_client::test_upper_camel_case_headers`. * Support upper Camel-Case headers * [actix-http] Add field `upper_camel_case_headers` for `RequestHead` * [actix-http] Add code for `MessageType` to support upper camel case * [awc] Add functions for `ClientRequest` to set upper camel case * Use `Flags::CAMEL_CASE` for upper camel case of headers
This commit is contained in:
@ -235,6 +235,20 @@ impl ClientRequest {
|
||||
self
|
||||
}
|
||||
|
||||
/// Is to uppercase headers with Camel-Case.
|
||||
/// Befault is `false`
|
||||
#[inline]
|
||||
pub fn upper_camel_case_headers(&self) -> bool {
|
||||
self.head.upper_camel_case_headers()
|
||||
}
|
||||
|
||||
/// Set `true` to send headers which are uppercased with Camel-Case.
|
||||
#[inline]
|
||||
pub fn set_upper_camel_case_headers(&mut self, value: bool) -> &mut Self {
|
||||
self.head.set_upper_camel_case_headers(value);
|
||||
self
|
||||
}
|
||||
|
||||
/// Force close connection instead of returning it back to connections pool.
|
||||
/// This setting affect only http/1 connections.
|
||||
#[inline]
|
||||
|
Reference in New Issue
Block a user