struct
Response
pub struct Response {
pub status: u16,
pub headers: Vec<(String, String)>,
pub body: String,
}An HTTP response.
Fields
Methods
new
pub fn new(status: u16, body: impl Into<String>) -> ResponseA response with status and body, and no headers.
with_header
pub fn with_header(self, name: &str, value: &str) -> ResponseThe response with header name added.
header
pub fn header(&self, name: &str) -> Option<&str>The value of header name (in any case), if the response has it.
json
pub fn json(&self) -> Result<Value, Error>The body as JSON; an error for non-2xx statuses (with the service's message when it gives one).