Function surf::patch[][src]

pub fn patch(uri: impl AsRef<str>) -> RequestBuilder

Notable traits for RequestBuilder

impl Future for RequestBuilder type Output = Result<Response>;

Perform a one-off PATCH request.

About the HTTP Method

The HTTP PATCH request method applies partial modifications to a resource.

The HTTP PUT method only allows complete replacement of a document. Unlike PUT, PATCH is not idempotent, meaning successive identical patch requests may have different effects. However, it is possible to issue PATCH requests in such a way as to be idempotent.

PATCH (like PUT) may have side-effects on other resources.

To find out whether a server supports PATCH, a server can advertise its support by adding it to the list in the Allow or Access-Control-Allow-Methods (for CORS) response headers.

Another (implicit) indication that PATCH is allowed, is the presence of the Accept-Patch header, which specifies the patch document formats accepted by the server.

Read more on MDN

Panics

This will panic if a malformed URL is passed.

Errors

Returns errors from the middleware, http backend, and network sockets.

Examples

let string = surf::patch("https://httpbin.org/patch").recv_string().await?;