Struct spacegate_kernel::plugins::context::SgCtxRequest
source · pub struct SgCtxRequest {
pub method: MaybeModified<Method>,
pub uri: MaybeModified<Uri>,
pub version: MaybeModified<Version>,
pub body: Body,
pub headers: MaybeModified<HeaderMap<HeaderValue>>,
pub remote_addr: SocketAddr,
}Fields§
§method: MaybeModified<Method>§uri: MaybeModified<Uri>§version: MaybeModified<Version>§body: Body§headers: MaybeModified<HeaderMap<HeaderValue>>§remote_addr: SocketAddrImplementations§
source§impl SgCtxRequest
impl SgCtxRequest
pub fn new( method: Method, uri: Uri, version: Version, headers: HeaderMap<HeaderValue>, body: Body, remote_addr: SocketAddr ) -> Self
pub fn get_method(&self) -> &Method
pub fn set_method(&mut self, method: Method)
pub fn get_method_raw(&self) -> &Method
pub fn get_uri(&self) -> &Uri
pub fn set_uri(&mut self, uri: Uri)
pub fn get_uri_raw(&self) -> &Uri
pub fn get_version(&self) -> &Version
pub fn set_version(&mut self, version: Version)
pub fn get_version_raw(&self) -> &Version
pub fn get_headers(&self) -> &HeaderMap<HeaderValue>
pub fn get_headers_mut(&mut self) -> &mut HeaderMap<HeaderValue>
pub fn set_headers(&mut self, req_headers: HeaderMap<HeaderValue>)
pub fn set_header_str(&mut self, key: &str, value: &str) -> TardisResult<()>
pub fn set_header(&mut self, key: HeaderName, value: &str) -> TardisResult<()>
pub fn get_headers_raw(&self) -> &HeaderMap<HeaderValue>
pub fn get_remote_addr(&self) -> &SocketAddr
pub fn take_body(&mut self) -> Body
pub fn replace_body(&mut self, body: impl Into<Body>) -> Body
pub fn set_body(&mut self, body: impl Into<Body>)
sourcepub async fn take_body_into_bytes(&mut self) -> TardisResult<Bytes>
pub async fn take_body_into_bytes(&mut self) -> TardisResult<Bytes>
it’s a shortcut for take_body + hyper::body::to_bytes
sourcepub async fn take_body_into_buf(&mut self) -> TardisResult<impl Buf>
pub async fn take_body_into_buf(&mut self) -> TardisResult<impl Buf>
it’s a shortcut for take_body + hyper::body::aggregate
sourcepub async fn dump_body(&mut self) -> TardisResult<Bytes>
pub async fn dump_body(&mut self) -> TardisResult<Bytes>
Performance
this method will read all of the body and clone it, and it’s body will become an once stream which holds the whole body.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for SgCtxRequest
impl Send for SgCtxRequest
impl Sync for SgCtxRequest
impl Unpin for SgCtxRequest
impl !UnwindSafe for SgCtxRequest
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