Trait anterofit::net::method::TakesBody[][src]

pub trait TakesBody { }

Trait describing an HTTP method which is allowed to have a body.

Motivation

Though not forbidden in the HTTP spec, GET and DELETE requests are generally not meant to have bodies, and it is recommended for servers to ignore bodies on such requests (IETF RFC 2616 (HTTP 1.1 Spec), Section 4.3).

Thus, this trait acts as a strongly typed anti-footgun for when you specified a GET or DELETE request when you actually meant POST or PUT or PATCH.

If you must have a body on a GET or DELETE request, you can use the force_body!() macro to override this protection.

Implementors