pub struct ProxyRequest {
pub method: Method,
pub path: String,
pub query: Option<String>,
pub headers: HeaderMap,
/* private fields */
}Expand description
Mutable view of the request a RequestTransform may edit before forwarding.
body is JSON when present; non-JSON bodies are exposed as raw bytes and are
not editable as JSON.
Fields§
§method: Method§path: String§query: Option<String>§headers: HeaderMapImplementations§
Source§impl ProxyRequest
impl ProxyRequest
pub fn from_parts( method: Method, path: String, query: Option<String>, headers: HeaderMap, bytes: Vec<u8>, ) -> Self
Sourcepub fn set_header(&mut self, name: &str, value: &str)
pub fn set_header(&mut self, name: &str, value: &str)
Overwrite a header (skips silently if name/value is invalid).
Sourcepub fn remove_header(&mut self, name: &str)
pub fn remove_header(&mut self, name: &str)
Remove a header entirely (used to strip a caller value when an injected context key is absent — fail-safe identity handling).
Sourcepub fn body_json_mut(&mut self) -> Result<&mut Value, TransformError>
pub fn body_json_mut(&mut self) -> Result<&mut Value, TransformError>
Mutable JSON body, parsing the raw bytes on first access. Errors if the body is not valid JSON (a body transform on a non-JSON body is a reject).
Sourcepub fn into_body_bytes(self) -> Vec<u8> ⓘ
pub fn into_body_bytes(self) -> Vec<u8> ⓘ
Serialize the (possibly transformed) body back to bytes for forwarding.
Sourcepub fn into_forward_parts(self) -> (HeaderMap, Vec<u8>)
pub fn into_forward_parts(self) -> (HeaderMap, Vec<u8>)
Headers + body ready for the upstream reqwest call.
When JSON transforms (inject/wrap on body) re-serialize the payload,
drop stale Content-Length / Transfer-Encoding from the client so
reqwest emits a length matching the new body (callers like urllib set
Content-Length for the pre-transform size).