Enum azure_functions::http::Body[][src]

pub enum Body<'a> {
    Empty,
    String(Cow<'a, str>),
    Json(Cow<'a, str>),
    Bytes(Cow<'a, [u8]>),
}

Represents the body of a HTTP request or response.

Variants

Represents an empty body.

Represents a string body with a default content type of text/plain.

Represents a JSON body with a default content type of application/json.

Represents a body from a slice of bytes with a default content type of application/octet-stream.

Methods

impl<'a> Body<'a>
[src]

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]

Formats the value using the given formatter. Read more

impl<'a> From<&'a str> for Body<'a>
[src]

Performs the conversion.

impl<'a> From<String> for Body<'a>
[src]

Performs the conversion.

impl<'a> From<Value> for Body<'a>
[src]

Performs the conversion.

impl<'a> From<&'a [u8]> for Body<'a>
[src]

Performs the conversion.

impl<'a> From<Vec<u8>> for Body<'a>
[src]

Performs the conversion.

Auto Trait Implementations

impl<'a> Send for Body<'a>

impl<'a> Sync for Body<'a>