Enum azure_functions::http::Body [−][src]
Represents the body of a HTTP request or response.
Variants
Empty
Represents an empty body.
String(Cow<'a, str>)
Represents a string body with a default content type of text/plain
.
Json(Cow<'a, str>)
Represents a JSON body with a default content type of application/json
.
Bytes(Cow<'a, [u8]>)
Represents a body from a slice of bytes with a default content type of application/octet-stream
.
Methods
impl<'a> Body<'a>
[src]
impl<'a> Body<'a>
pub fn default_content_type(&self) -> &str
[src]
pub fn default_content_type(&self) -> &str
Gets the default content type for a body.
Returns application/json
for Body::Json
.
Returns application/octet-stream
for Body::Bytes
.
Returns text/plain
for all other Body
values.
Examples
use azure_functions::http::Body; let body: Body = [1u8, 2u8, 3u8][..].into(); assert_eq!(body.default_content_type(), "application/octet-stream");
Trait Implementations
impl<'a> Debug for Body<'a>
[src]
impl<'a> Debug for Body<'a>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<'a> From<&'a str> for Body<'a>
[src]
impl<'a> From<&'a str> for Body<'a>
impl<'a> From<String> for Body<'a>
[src]
impl<'a> From<String> for Body<'a>
impl<'a> From<Value> for Body<'a>
[src]
impl<'a> From<Value> for Body<'a>
impl<'a> From<&'a [u8]> for Body<'a>
[src]
impl<'a> From<&'a [u8]> for Body<'a>
impl<'a> From<Vec<u8>> for Body<'a>
[src]
impl<'a> From<Vec<u8>> for Body<'a>