Struct spot::response::Response[][src]

pub struct Response {
    pub status: u16,
    pub body: Vec<u8>,
    pub headers: HashMap<String, String>,
}

Fields

status: u16

Status code for the response

body: Vec<u8>

The response body. If there is no body this is empty

headers: HashMap<String, String>

Contains all the desired response headers. No headers are added automatically except for content-length and content-type when adding a body

Implementations

Creates a new http response object

Updates the response status

Adds a new header to the response

Adds a body from a String to the request, overwrites previous body, then adds content length and content type “text/plain”.

Adds a body from a byte array, then sets the content-length header to be equal to the size of the array

Converts the reponse to an array of bytes in order to write it over the TCP stream. This always writes in the HTTP/1.1 format

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.