pub struct Response {
    pub code: StatusCode,
    pub content_type: HeaderValue,
    pub content: String,
}
Expand description

Simple server response structure

Fields

code: StatusCode

Response code

content_type: HeaderValue

Response content type

content: String

Response body

Implementations

Create a response with empty body and 200 OK status code.

Create a response with given body and 200 OK status code.

Create a response for plaintext internal error.

Create a json response for service unavailable.

Create a response for not allowed hosts.

Create a response for unsupported content type.

Create a response for disallowed method used.

CORS invalid

CORS header invalid

Create a response for bad request

Create a response for too large (413)

Trait Implementations

Formats the value using the given formatter. Read more

Converts from a jsonrpc Response to a hyper::Response

Panics

Panics if the response cannot be converted due to failure to parse body content.

Performs the conversion.

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.