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.
Auto Trait Implementations§
impl Freeze for ProxyRequest
impl RefUnwindSafe for ProxyRequest
impl Send for ProxyRequest
impl Sync for ProxyRequest
impl Unpin for ProxyRequest
impl UnsafeUnpin for ProxyRequest
impl UnwindSafe for ProxyRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more