macro_rules! response { ($type:ident) => { ... }; ($type:ident,$body:expr) => { ... }; ($type:ident,$body:expr,$headers:expr) => { ... }; ($type:ident,$body:expr,$headers:expr,$http_version:expr) => { ... }; }
Expand description
A quick way to create responses.
Usage:
use snowboard::{response, HttpVersion};
// Response with no headers and no body.
let response = response!(bad_request);
// Response with body and no headers.
// Note that $body requires to be convertible to a String.
let response = response!(internal_server_error, "oopsies");
// Response with body, headers and custom HTTP version.
let body = "everything's fine!";
let headers = vec![("a", "b")];
let response = response!(ok, body, headers, HttpVersion::V1_0);