pub enum Body<'a> {
Absent,
Json(&'a [u8]),
Form(&'a [u8]),
}Expand description
The HTTP request body the BodyMapping reads.
Variants§
Absent
No body is read. Under BodyMapping::Field the field still belongs
to the body (a raw google.api.HttpBody filled afterwards), so query
parameters leave it alone.
Json(&'a [u8])
A JSON body (ProtoJSON of the mapped message or field). Empty means
{}.
Form(&'a [u8])
An application/x-www-form-urlencoded body, bound field by field like
query parameters.
Implementations§
Source§impl<'a> Body<'a>
impl<'a> Body<'a>
Sourcepub fn new(content_type: Option<&str>, bytes: &'a [u8]) -> Self
pub fn new(content_type: Option<&str>, bytes: &'a [u8]) -> Self
The body as its media type (no parameters) says: a form for
application/x-www-form-urlencoded, JSON otherwise.
§Examples
use structured_proxy::transcode::request::Body;
let form = Body::new(Some("application/x-www-form-urlencoded"), b"a=1");
assert_eq!(form, Body::Form(b"a=1"));
assert_eq!(Body::new(None, b"{}"), Body::Json(b"{}"));Trait Implementations§
impl<'a> Copy for Body<'a>
impl<'a> Eq for Body<'a>
impl<'a> StructuralPartialEq for Body<'a>
Auto Trait Implementations§
impl<'a> Freeze for Body<'a>
impl<'a> RefUnwindSafe for Body<'a>
impl<'a> Send for Body<'a>
impl<'a> Sync for Body<'a>
impl<'a> Unpin for Body<'a>
impl<'a> UnsafeUnpin for Body<'a>
impl<'a> UnwindSafe for Body<'a>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request