Silence warnings during testing.

This commit is contained in:
Sergio Benitez 2017-02-02 02:16:21 -08:00
parent 7b8d104ae0
commit a9c3b8a919
28 changed files with 92 additions and 23 deletions

View File

@ -42,8 +42,11 @@ fn user_page(username: &str) -> String {
format!("This is {}'s page.", username)
}
fn main() {
pub fn rocket() -> rocket::Rocket {
rocket::ignite()
.mount("/", routes![files::index, files::files, user_page, login])
.launch();
}
fn main() {
rocket().launch()
}

View File

@ -1,11 +1,12 @@
use super::rocket;
use rocket::testing::MockRequest;
use rocket::http::Method::*;
use rocket::http::{ContentType, Status};
use super::rocket;
fn test_login(username: &str, password: &str, age: isize, status: Status,
body: Option<&'static str>) {
let rocket = rocket::ignite().mount("/", routes![super::user_page, super::login]);
let rocket = rocket();
let mut req = MockRequest::new(Post, "/login")
.header(ContentType::Form)
.body(&format!("username={}&password={}&age={}", username, password, age));
@ -38,12 +39,12 @@ fn test_bad_login() {
}
fn check_bad_form(form_str: &str, status: Status) {
let rocket = rocket::ignite().mount("/", routes![super::user_page, super::login]);
let rocket = rocket();
let mut req = MockRequest::new(Post, "/login")
.header(ContentType::Form)
.body(form_str);
let mut response = req.dispatch_with(&rocket);
let response = req.dispatch_with(&rocket);
assert_eq!(response.status(), status);
}

View File

@ -6,6 +6,7 @@ use self::schema::tasks::dsl::{tasks as all_tasks, completed as task_completed};
const DATABASE_FILE: &'static str = env!("DATABASE_URL");
#[allow(dead_code)]
mod schema {
infer_schema!("env:DATABASE_URL");
}

View File

@ -76,6 +76,7 @@ impl Catcher {
/// # Examples
///
/// ```rust
/// # #![allow(unused_variables)]
/// use rocket::{Catcher, Request, Error};
/// use rocket::response::{Result, Responder};
///

View File

@ -225,7 +225,7 @@ impl Config {
/// # Example
///
/// ```rust
/// use rocket::config::{Config, Environment, Value};
/// use rocket::config::{Config, Environment};
///
/// // Create a new config with a session key.
/// let key = "adL5fFIPmZBrlyHk2YT4NLV3YCk2gFXz";

View File

@ -132,6 +132,7 @@
//!
//! const DEFAULT_TEMPLATE_DIR: &'static str = "templates";
//!
//! # #[allow(unused_variables)]
//! let template_dir = config::active().map(|config| {
//! let dir = config.get_str("template_dir")
//! .map_err(|e| if !e.is_not_found() { e.pretty_print(); })

View File

@ -59,6 +59,7 @@ impl<'a, S, E> IntoOutcome<S, (Status, E), Data> for Result<S, E> {
/// Say that you have a custom type, `Person`:
///
/// ```rust
/// # #[allow(dead_code)]
/// struct Person {
/// name: String,
/// age: u16
@ -80,6 +81,8 @@ impl<'a, S, E> IntoOutcome<S, (Status, E), Data> for Result<S, E> {
/// A `FromData` implementation allowing this looks like:
///
/// ```rust
/// # #![allow(unused_attributes)]
/// # #![allow(unused_variables)]
/// # #![feature(plugin)]
/// # #![plugin(rocket_codegen)]
/// # extern crate rocket;
@ -118,7 +121,7 @@ impl<'a, S, E> IntoOutcome<S, (Status, E), Data> for Result<S, E> {
/// // Parse the age.
/// let age: u16 = match age.parse() {
/// Ok(age) => age,
/// Err(e) => return Failure((Status::BadRequest, "Bad age.".into()))
/// Err(_) => return Failure((Status::BadRequest, "Bad age.".into()))
/// };
///
/// // Return successfully.

View File

@ -22,6 +22,7 @@ use http::ascii::{uncased_eq, UncasedAscii};
/// ```rust
/// use rocket::http::ContentType;
///
/// # #[allow(unused_variables)]
/// let html = ContentType::HTML;
/// ```
///
@ -34,6 +35,7 @@ use http::ascii::{uncased_eq, UncasedAscii};
/// use rocket::http::ContentType;
/// use rocket::response::Response;
///
/// # #[allow(unused_variables)]
/// let response = Response::build().header(ContentType::HTML).finalize();
/// ```
#[derive(Debug, Clone, PartialEq, Hash)]

View File

@ -167,7 +167,7 @@ impl<'h> HeaderMap<'h> {
/// # Example
///
/// ```rust
/// use rocket::http::{HeaderMap, ContentType};
/// use rocket::http::HeaderMap;
///
/// let map = HeaderMap::new();
/// assert!(map.is_empty());
@ -183,7 +183,7 @@ impl<'h> HeaderMap<'h> {
/// # Example
///
/// ```rust
/// use rocket::http::{HeaderMap, ContentType};
/// use rocket::http::HeaderMap;
///
/// let mut map = HeaderMap::new();
/// map.add_raw("X-Custom", "value_1");
@ -212,7 +212,7 @@ impl<'h> HeaderMap<'h> {
/// Retrieve the first value when one exists:
///
/// ```rust
/// use rocket::http::{HeaderMap, ContentType};
/// use rocket::http::HeaderMap;
///
/// let mut map = HeaderMap::new();
/// map.add_raw("X-Custom", "value_1");
@ -220,19 +220,19 @@ impl<'h> HeaderMap<'h> {
///
/// assert_eq!(map.len(), 2);
///
/// let mut first_value = map.get_one("X-Custom");
/// let first_value = map.get_one("X-Custom");
/// assert_eq!(first_value, Some("value_1"));
/// ```
///
/// Attempt to retrieve a value that doesn't exist:
///
/// ```rust
/// use rocket::http::{HeaderMap, ContentType};
/// use rocket::http::HeaderMap;
///
/// let mut map = HeaderMap::new();
/// map.add_raw("X-Custom", "value_1");
///
/// let mut first_value = map.get_one("X-Other");
/// let first_value = map.get_one("X-Other");
/// assert_eq!(first_value, None);
/// ```
#[inline]

View File

@ -34,6 +34,7 @@ pub enum StatusClass {
/// ```rust
/// use rocket::http::Status;
///
/// # #[allow(unused_variables)]
/// let ok = Status::Ok;
/// ```
///
@ -42,6 +43,7 @@ pub enum StatusClass {
/// ```rust
/// use rocket::http::Status;
///
/// # #[allow(unused_variables)]
/// let not_found = Status::NotFound;
/// ```
///

View File

@ -303,7 +303,6 @@ unsafe impl<'a> Sync for URI<'a> { /* It's safe! */ }
///
/// ```rust
/// use rocket::http::uri::URI;
/// use rocket::http::uri::Segments;
///
/// let uri = URI::new("/a/////b/c////////d");
/// let segments = uri.segments();

View File

@ -50,6 +50,7 @@
//!
//! ```rust
//! #![feature(plugin)]
//! # #![allow(unused_attributes)]
//! #![plugin(rocket_codegen)]
//!
//! extern crate rocket;

View File

@ -10,6 +10,7 @@ use request::FormItems;
/// ```rust
/// #![feature(plugin, custom_derive)]
/// #![plugin(rocket_codegen)]
/// # #![allow(deprecated, dead_code, unused_attributes)]
///
/// extern crate rocket;
///
@ -25,6 +26,7 @@ use request::FormItems;
///
/// ```rust
/// # #![feature(plugin, custom_derive)]
/// # #![allow(deprecated, dead_code, unused_attributes)]
/// # #![plugin(rocket_codegen)]
/// # extern crate rocket;
/// # use rocket::request::Form;

View File

@ -38,6 +38,7 @@ use http::uri::URI;
/// following structure:
///
/// ```rust
/// # #[allow(dead_code)]
/// struct Person<'r> {
/// name: String,
/// age: Result<u16, &'r str>
@ -106,7 +107,6 @@ use http::uri::URI;
///
/// ```rust
/// use rocket::request::FromFormValue;
/// use rocket::Error;
///
/// struct AdultAge(usize);
///

View File

@ -69,6 +69,7 @@ use outcome::Outcome::*;
///
/// ```rust
/// # #![feature(plugin, custom_derive)]
/// # #![allow(deprecated, dead_code, unused_attributes)]
/// # #![plugin(rocket_codegen)]
/// # extern crate rocket;
/// #[derive(FromForm)]
@ -82,6 +83,7 @@ use outcome::Outcome::*;
///
/// ```rust
/// # #![feature(plugin, custom_derive)]
/// # #![allow(deprecated, unused_attributes)]
/// # #![plugin(rocket_codegen)]
/// # extern crate rocket;
/// # use rocket::request::Form;
@ -106,6 +108,7 @@ use outcome::Outcome::*;
///
/// ```rust
/// # #![feature(plugin, custom_derive)]
/// # #![allow(deprecated, dead_code, unused_attributes)]
/// # #![plugin(rocket_codegen)]
/// # extern crate rocket;
/// #[derive(FromForm)]
@ -118,6 +121,7 @@ use outcome::Outcome::*;
///
/// ```rust
/// # #![feature(plugin, custom_derive)]
/// # #![allow(deprecated, unused_attributes)]
/// # #![plugin(rocket_codegen)]
/// # extern crate rocket;
/// # use rocket::request::Form;

View File

@ -169,6 +169,7 @@ impl<S, E> IntoOutcome<S, (Status, E), ()> for Result<S, E> {
///
/// #[get("/sensitive")]
/// fn sensitive(key: APIKey) -> &'static str {
/// # let _key = key;
/// "Sensitive data."
/// }
///

View File

@ -24,6 +24,7 @@ use http::uri::{URI, Segments, SegmentError};
/// # extern crate rocket;
/// #[get("/<id>")]
/// fn hello(id: usize) -> String {
/// # let _id = id;
/// # /*
/// ...
/// # */
@ -127,6 +128,7 @@ use http::uri::{URI, Segments, SegmentError};
/// `key` and the number after the colon is stored in `value`:
///
/// ```rust
/// # #[allow(dead_code)]
/// struct MyParam<'r> {
/// key: &'r str,
/// value: usize
@ -137,6 +139,7 @@ use http::uri::{URI, Segments, SegmentError};
///
/// ```rust
/// use rocket::request::FromParam;
/// # #[allow(dead_code)]
/// # struct MyParam<'r> { key: &'r str, value: usize }
///
/// impl<'r> FromParam<'r> for MyParam<'r> {
@ -170,6 +173,7 @@ use http::uri::{URI, Segments, SegmentError};
/// # #![plugin(rocket_codegen)]
/// # extern crate rocket;
/// # use rocket::request::FromParam;
/// # #[allow(dead_code)]
/// # struct MyParam<'r> { key: &'r str, value: usize }
/// # impl<'r> FromParam<'r> for MyParam<'r> {
/// # type Error = &'r str;
@ -180,6 +184,7 @@ use http::uri::{URI, Segments, SegmentError};
/// #
/// #[get("/<key_val>")]
/// fn hello(key_val: MyParam) -> String {
/// # let _kv = key_val;
/// # /*
/// ...
/// # */

View File

@ -44,6 +44,7 @@ impl<'r> Request<'r> {
/// use rocket::Request;
/// use rocket::http::Method;
///
/// # #[allow(unused_variables)]
/// let request = Request::new(Method::Get, "/uri");
/// ```
pub fn new<U: Into<URI<'r>>>(method: Method, uri: U) -> Request<'r> {
@ -101,7 +102,7 @@ impl<'r> Request<'r> {
/// use rocket::Request;
/// use rocket::http::Method;
///
/// let mut request = Request::new(Method::Get, "/uri");
/// let request = Request::new(Method::Get, "/uri");
/// assert_eq!(request.uri().as_str(), "/uri");
/// ```
#[inline(always)]
@ -179,9 +180,9 @@ impl<'r> Request<'r> {
///
/// ```rust
/// use rocket::Request;
/// use rocket::http::{Method, ContentType};
/// use rocket::http::Method;
///
/// let mut request = Request::new(Method::Get, "/uri");
/// let request = Request::new(Method::Get, "/uri");
/// let header_map = request.headers();
/// assert!(header_map.is_empty());
/// ```
@ -244,9 +245,9 @@ impl<'r> Request<'r> {
///
/// ```rust
/// use rocket::Request;
/// use rocket::http::{Cookie, Method, ContentType};
/// use rocket::http::{Cookie, Method};
///
/// let mut request = Request::new(Method::Get, "/uri");
/// let request = Request::new(Method::Get, "/uri");
/// request.cookies().add(Cookie::new("key", "val"));
/// request.cookies().add(Cookie::new("ans", format!("life: {}", 38 + 4)));
/// ```
@ -300,6 +301,7 @@ impl<'r> Request<'r> {
/// use rocket::{Request, Data};
/// use rocket::handler::Outcome;
///
/// # #[allow(dead_code)]
/// fn name<'a>(req: &'a Request, _: Data) -> Outcome<'a> {
/// Outcome::of(req.get_param(0).unwrap_or("unnamed"))
/// }

View File

@ -18,6 +18,7 @@
//! ```rust
//! use rocket::response::content;
//!
//! # #[allow(unused_variables)]
//! let response = content::HTML("<h1>Hello, world!</h1>");
//! ```
@ -36,6 +37,7 @@ use http::{Status, ContentType};
/// use rocket::response::content::Content;
/// use rocket::http::ContentType;
///
/// # #[allow(unused_variables)]
/// let response = Content(ContentType::PDF, "Hi.");
/// ```
#[derive(Debug, Clone, PartialEq)]

View File

@ -101,6 +101,7 @@ impl<'r, R: Responder<'r>> Flash<R> {
/// ```rust
/// use rocket::response::{Redirect, Flash};
///
/// # #[allow(unused_variables)]
/// let msg = Flash::new(Redirect::to("/"), "suggestion", "Try this out!");
/// ```
pub fn new<N: AsRef<str>, M: AsRef<str>>(res: R, name: N, msg: M) -> Flash<R> {
@ -122,6 +123,7 @@ impl<'r, R: Responder<'r>> Flash<R> {
/// ```rust
/// use rocket::response::{Redirect, Flash};
///
/// # #[allow(unused_variables)]
/// let msg = Flash::success(Redirect::to("/"), "It worked!");
/// ```
pub fn success<S: AsRef<str>>(responder: R, msg: S) -> Flash<R> {
@ -139,6 +141,7 @@ impl<'r, R: Responder<'r>> Flash<R> {
/// ```rust
/// use rocket::response::{Redirect, Flash};
///
/// # #[allow(unused_variables)]
/// let msg = Flash::warning(Redirect::to("/"), "Watch out!");
/// ```
pub fn warning<S: AsRef<str>>(responder: R, msg: S) -> Flash<R> {
@ -156,6 +159,7 @@ impl<'r, R: Responder<'r>> Flash<R> {
/// ```rust
/// use rocket::response::{Redirect, Flash};
///
/// # #[allow(unused_variables)]
/// let msg = Flash::error(Redirect::to("/"), "Whoops!");
/// ```
pub fn error<S: AsRef<str>>(responder: R, msg: S) -> Flash<R> {

View File

@ -25,6 +25,7 @@ impl NamedFile {
/// ```rust
/// use rocket::response::NamedFile;
///
/// # #[allow(unused_variables)]
/// let file = NamedFile::open("foo.txt");
/// ```
pub fn open<P: AsRef<Path>>(path: P) -> io::Result<NamedFile> {
@ -58,6 +59,7 @@ impl NamedFile {
/// # use std::io;
/// use rocket::response::NamedFile;
///
/// # #[allow(dead_code)]
/// # fn demo_path() -> io::Result<()> {
/// let file = NamedFile::open("foo.txt")?;
/// assert_eq!(file.path().as_os_str(), "foo.txt");

View File

@ -19,6 +19,7 @@ impl Redirect {
/// ```rust
/// use rocket::response::Redirect;
///
/// # #[allow(unused_variables)]
/// let redirect = Redirect::to("/other_url");
/// ```
pub fn to(uri: &str) -> Redirect {
@ -36,6 +37,7 @@ impl Redirect {
/// ```rust
/// use rocket::response::Redirect;
///
/// # #[allow(unused_variables)]
/// let redirect = Redirect::temporary("/other_url");
/// ```
pub fn temporary(uri: &str) -> Redirect {
@ -54,6 +56,7 @@ impl Redirect {
/// ```rust
/// use rocket::response::Redirect;
///
/// # #[allow(unused_variables)]
/// let redirect = Redirect::permanent("/other_url");
/// ```
pub fn permanent(uri: &str) -> Redirect {
@ -72,6 +75,7 @@ impl Redirect {
/// ```rust
/// use rocket::response::Redirect;
///
/// # #[allow(unused_variables)]
/// let redirect = Redirect::found("/other_url");
/// ```
pub fn found(uri: &str) -> Redirect {
@ -88,6 +92,7 @@ impl Redirect {
/// ```rust
/// use rocket::response::Redirect;
///
/// # #[allow(unused_variables)]
/// let redirect = Redirect::moved("/other_url");
/// ```
pub fn moved(uri: &str) -> Redirect {

View File

@ -100,6 +100,8 @@ use response::{Response, Stream};
/// Say that you have a custom type, `Person`:
///
/// ```rust
///
/// # #[allow(dead_code)]
/// struct Person {
/// name: String,
/// age: u16

View File

@ -129,6 +129,7 @@ impl<T> fmt::Debug for Body<T> {
/// use rocket::response::Response;
/// use rocket::http::{Status, ContentType};
///
/// # #[allow(unused_variables)]
/// let response = Response::build()
/// .status(Status::ImATeapot)
/// .header(ContentType::Plain)
@ -152,6 +153,7 @@ impl<'r> ResponseBuilder<'r> {
/// ```rust
/// use rocket::response::{ResponseBuilder, Response};
///
/// # #[allow(unused_variables)]
/// let builder = ResponseBuilder::new(Response::new());
/// ```
#[inline(always)]
@ -169,6 +171,7 @@ impl<'r> ResponseBuilder<'r> {
/// use rocket::Response;
/// use rocket::http::Status;
///
/// # #[allow(unused_variables)]
/// let response = Response::build()
/// .status(Status::NotFound)
/// .finalize();
@ -187,6 +190,7 @@ impl<'r> ResponseBuilder<'r> {
/// ```rust
/// use rocket::Response;
///
/// # #[allow(unused_variables)]
/// let response = Response::build()
/// .raw_status(699, "Alien Encounter")
/// .finalize();
@ -269,7 +273,6 @@ impl<'r> ResponseBuilder<'r> {
///
/// ```rust
/// use rocket::Response;
/// use rocket::http::ContentType;
///
/// let response = Response::build()
/// .raw_header("X-Custom", "first")
@ -323,7 +326,9 @@ impl<'r> ResponseBuilder<'r> {
/// use std::fs::File;
/// # use std::io;
///
/// # #[allow(dead_code)]
/// # fn test() -> io::Result<()> {
/// # #[allow(unused_variables)]
/// let response = Response::build()
/// .sized_body(File::open("body.txt")?)
/// .finalize();
@ -347,7 +352,9 @@ impl<'r> ResponseBuilder<'r> {
/// use std::fs::File;
/// # use std::io;
///
/// # #[allow(dead_code)]
/// # fn test() -> io::Result<()> {
/// # #[allow(unused_variables)]
/// let response = Response::build()
/// .streamed_body(File::open("body.txt")?)
/// .finalize();
@ -372,7 +379,9 @@ impl<'r> ResponseBuilder<'r> {
/// use std::fs::File;
/// # use std::io;
///
/// # #[allow(dead_code)]
/// # fn test() -> io::Result<()> {
/// # #[allow(unused_variables)]
/// let response = Response::build()
/// .chunked_body(File::open("body.txt")?, 8096)
/// .finalize();
@ -481,6 +490,7 @@ impl<'r> ResponseBuilder<'r> {
/// ```rust
/// use rocket::Response;
///
/// # #[allow(unused_variables)]
/// let response = Response::build()
/// // build the response
/// .finalize();
@ -551,6 +561,7 @@ impl<'r> Response<'r> {
/// ```rust
/// use rocket::Response;
///
/// # #[allow(unused_variables)]
/// let builder = Response::build();
/// ```
#[inline(always)]
@ -563,6 +574,7 @@ impl<'r> Response<'r> {
/// # Example
///
/// ```rust
/// # #![allow(unused_variables)]
/// use rocket::Response;
///
/// let other = Response::new();
@ -791,7 +803,6 @@ impl<'r> Response<'r> {
///
/// ```rust
/// use rocket::Response;
/// use rocket::http::Header;
///
/// let mut response = Response::new();
///

View File

@ -26,6 +26,7 @@ use http::Status;
///
/// let url = "http://myservice.com/resource.json".to_string();
/// let content = "{ 'resource': 'Hello, world!' }";
/// # #[allow(unused_variables)]
/// let response = status::Created(url, Some(content));
/// ```
#[derive(Debug, Clone, PartialEq)]
@ -81,6 +82,7 @@ impl<'r, R: Responder<'r> + Hash> Responder<'r> for Created<R> {
/// ```rust
/// use rocket::response::status;
///
/// # #[allow(unused_variables)]
/// let response = status::Accepted::<()>(None);
/// ```
///
@ -89,6 +91,7 @@ impl<'r, R: Responder<'r> + Hash> Responder<'r> for Created<R> {
/// ```rust
/// use rocket::response::status;
///
/// # #[allow(unused_variables)]
/// let response = status::Accepted(Some("processing"));
/// ```
#[derive(Debug, Clone, PartialEq)]
@ -114,6 +117,7 @@ impl<'r, R: Responder<'r>> Responder<'r> for Accepted<R> {
/// ```rust
/// use rocket::response::status;
///
/// # #[allow(unused_variables)]
/// let response = status::NoContent;
/// ```
// TODO: This would benefit from Header support.
@ -136,6 +140,7 @@ impl<'r> Responder<'r> for NoContent {
/// ```rust
/// use rocket::response::status;
///
/// # #[allow(unused_variables)]
/// let response = status::Reset;
/// ```
#[derive(Debug, Copy, Clone, PartialEq)]
@ -157,6 +162,7 @@ impl<'r> Responder<'r> for Reset {
/// use rocket::response::status;
/// use rocket::http::Status;
///
/// # #[allow(unused_variables)]
/// let response = status::Custom(Status::ImATeapot, "Hi!");
/// ```
#[derive(Debug, Clone, PartialEq)]

View File

@ -24,6 +24,7 @@ impl<T: Read> Stream<T> {
/// use std::io;
/// use rocket::response::Stream;
///
/// # #[allow(unused_variables)]
/// let response = Stream::from(io::stdin());
/// ```
pub fn from(reader: T) -> Stream<T> {
@ -42,6 +43,7 @@ impl<T: Read> Stream<T> {
/// use std::io;
/// use rocket::response::Stream;
///
/// # #[allow(unused_variables)]
/// let response = Stream::chunked(io::stdin(), 10);
/// ```
pub fn chunked(reader: T, chunk_size: u64) -> Stream<T> {

View File

@ -317,12 +317,14 @@ impl Rocket {
/// use rocket::config::{Config, Environment};
/// # use rocket::config::ConfigError;
///
/// # #[allow(dead_code)]
/// # fn try_config() -> Result<(), ConfigError> {
/// let config = Config::build(Environment::Staging)
/// .address("1.2.3.4")
/// .port(9234)
/// .finalize()?;
///
/// # #[allow(unused_variables)]
/// let app = rocket::custom(config, false);
/// # Ok(())
/// # }
@ -509,6 +511,7 @@ impl Rocket {
/// fn main() {
/// # if false { // We don't actually want to launch the server in an example.
/// rocket::ignite()
/// .mount("/", routes![index])
/// .manage(MyValue(10))
/// # .launch()
/// # }

View File

@ -137,6 +137,7 @@ impl<'r> MockRequest<'r> {
/// use rocket::testing::MockRequest;
/// use rocket::http::ContentType;
///
/// # #[allow(unused_variables)]
/// let req = MockRequest::new(Get, "/").header(ContentType::JSON);
/// ```
#[inline]
@ -175,6 +176,7 @@ impl<'r> MockRequest<'r> {
/// use rocket::testing::MockRequest;
///
/// let address = "8.8.8.8:80".parse().unwrap();
/// # #[allow(unused_variables)]
/// let req = MockRequest::new(Get, "/").remote(address);
/// ```
#[inline]
@ -194,6 +196,7 @@ impl<'r> MockRequest<'r> {
/// use rocket::testing::MockRequest;
/// use rocket::http::Cookie;
///
/// # #[allow(unused_variables)]
/// let req = MockRequest::new(Get, "/")
/// .cookie(Cookie::new("username", "sb"))
/// .cookie(Cookie::new("user_id", format!("{}", 12)));
@ -215,6 +218,7 @@ impl<'r> MockRequest<'r> {
/// use rocket::testing::MockRequest;
/// use rocket::http::ContentType;
///
/// # #[allow(unused_variables)]
/// let req = MockRequest::new(Post, "/")
/// .header(ContentType::JSON)
/// .body(r#"{ "key": "value", "array": [1, 2, 3], }"#);