Struct spacegate_kernel::plugins::context::SgCtxResponse
source · pub struct SgCtxResponse {
pub status_code: MaybeModified<StatusCode>,
pub headers: MaybeModified<HeaderMap<HeaderValue>>,
pub body: Body,
/* private fields */
}Fields§
§status_code: MaybeModified<StatusCode>§headers: MaybeModified<HeaderMap<HeaderValue>>§body: BodyImplementations§
source§impl SgCtxResponse
impl SgCtxResponse
pub fn new() -> Self
pub fn is_resp_error(&self) -> bool
pub fn get_status_code(&self) -> &StatusCode
pub fn set_status_code(&mut self, status_code: StatusCode)
pub fn get_status_code_raw(&self) -> &StatusCode
pub fn get_headers(&self) -> &HeaderMap<HeaderValue>
pub fn get_headers_raw(&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 remove_header(&mut self, key: HeaderName) -> TardisResult<()>
pub fn remove_header_str(&mut self, key: &str) -> TardisResult<()>
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§
source§impl Debug for SgCtxResponse
impl Debug for SgCtxResponse
Auto Trait Implementations§
impl !RefUnwindSafe for SgCtxResponse
impl Send for SgCtxResponse
impl Sync for SgCtxResponse
impl Unpin for SgCtxResponse
impl !UnwindSafe for SgCtxResponse
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