From 1d541763c6c70cbd9b79448c7ea5c71d615fd1fb Mon Sep 17 00:00:00 2001 From: Martin Algesten Date: Mon, 2 Jul 2018 12:32:01 +0200 Subject: [PATCH] get_method --- src/request.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/request.rs b/src/request.rs index b28745c..6c7f830 100644 --- a/src/request.rs +++ b/src/request.rs @@ -464,6 +464,18 @@ impl Request { // unimplemented!() // } + /// Get the method this request is using. + /// + /// Example: + /// ``` + /// let req = ureq::post("/somewhere") + /// .build(); + /// assert_eq!(req.get_method(), "POST"); + /// ``` + pub fn get_method(&self) -> &str { + &self.method + } + fn to_url(&self) -> Result { URL_BASE .join(&self.path)