diff --git a/contrib/intellij/Hurl.xml b/contrib/intellij/Hurl.xml
index 599a1eebd..a425e5f10 100644
--- a/contrib/intellij/Hurl.xml
+++ b/contrib/intellij/Hurl.xml
@@ -7,7 +7,7 @@
-
GET http://localhost:8000/methods/get
+HTTP 200
+
+HEAD http://localhost:8000/methods/head
+HTTP 200
+
+POST http://localhost:8000/methods/post
+HTTP 200
+
+PUT http://localhost:8000/methods/put
+HTTP 200
+
+DELETE http://localhost:8000/methods/delete
+HTTP 200
+
+CONNECT http://localhost:8000/methods/connect
+HTTP 200
+
+OPTIONS http://localhost:8000/methods/options
+HTTP 200
+
+TRACE http://localhost:8000/methods/trace
+HTTP 200
+
+PATCH http://localhost:8000/methods/patch
+HTTP 200
+
+LINK http://localhost:8000/methods/link
+HTTP 200
+
+UNLINK http://localhost:8000/methods/unlink
+HTTP 200
+
+PURGE http://localhost:8000/methods/purge
+HTTP 200
+
+LOCK http://localhost:8000/methods/lock
+HTTP 200
+
+UNLOCK http://localhost:8000/methods/unlock
+HTTP 200
+
+PROPFIND http://localhost:8000/methods/propfind
+HTTP 200
+
+VIEW http://localhost:8000/methods/view
+HTTP 200
+
diff --git a/integration/tests_ok/method.hurl b/integration/tests_ok/method.hurl
new file mode 100644
index 000000000..a177edeeb
--- /dev/null
+++ b/integration/tests_ok/method.hurl
@@ -0,0 +1,47 @@
+GET http://localhost:8000/methods/get
+HTTP 200
+
+HEAD http://localhost:8000/methods/head
+HTTP 200
+
+POST http://localhost:8000/methods/post
+HTTP 200
+
+PUT http://localhost:8000/methods/put
+HTTP 200
+
+DELETE http://localhost:8000/methods/delete
+HTTP 200
+
+CONNECT http://localhost:8000/methods/connect
+HTTP 200
+
+OPTIONS http://localhost:8000/methods/options
+HTTP 200
+
+TRACE http://localhost:8000/methods/trace
+HTTP 200
+
+PATCH http://localhost:8000/methods/patch
+HTTP 200
+
+LINK http://localhost:8000/methods/link
+HTTP 200
+
+UNLINK http://localhost:8000/methods/unlink
+HTTP 200
+
+PURGE http://localhost:8000/methods/purge
+HTTP 200
+
+LOCK http://localhost:8000/methods/lock
+HTTP 200
+
+UNLOCK http://localhost:8000/methods/unlock
+HTTP 200
+
+PROPFIND http://localhost:8000/methods/propfind
+HTTP 200
+
+VIEW http://localhost:8000/methods/view
+HTTP 200
diff --git a/integration/tests_ok/method.json b/integration/tests_ok/method.json
new file mode 100644
index 000000000..4b608d62d
--- /dev/null
+++ b/integration/tests_ok/method.json
@@ -0,0 +1 @@
+{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/methods/get"},"response":{"status":200}},{"request":{"method":"HEAD","url":"http://localhost:8000/methods/head"},"response":{"status":200}},{"request":{"method":"POST","url":"http://localhost:8000/methods/post"},"response":{"status":200}},{"request":{"method":"PUT","url":"http://localhost:8000/methods/put"},"response":{"status":200}},{"request":{"method":"DELETE","url":"http://localhost:8000/methods/delete"},"response":{"status":200}},{"request":{"method":"CONNECT","url":"http://localhost:8000/methods/connect"},"response":{"status":200}},{"request":{"method":"OPTIONS","url":"http://localhost:8000/methods/options"},"response":{"status":200}},{"request":{"method":"TRACE","url":"http://localhost:8000/methods/trace"},"response":{"status":200}},{"request":{"method":"PATCH","url":"http://localhost:8000/methods/patch"},"response":{"status":200}},{"request":{"method":"LINK","url":"http://localhost:8000/methods/link"},"response":{"status":200}},{"request":{"method":"UNLINK","url":"http://localhost:8000/methods/unlink"},"response":{"status":200}},{"request":{"method":"PURGE","url":"http://localhost:8000/methods/purge"},"response":{"status":200}},{"request":{"method":"LOCK","url":"http://localhost:8000/methods/lock"},"response":{"status":200}},{"request":{"method":"UNLOCK","url":"http://localhost:8000/methods/unlock"},"response":{"status":200}},{"request":{"method":"PROPFIND","url":"http://localhost:8000/methods/propfind"},"response":{"status":200}},{"request":{"method":"VIEW","url":"http://localhost:8000/methods/view"},"response":{"status":200}}]}
diff --git a/integration/tests_ok/method.py b/integration/tests_ok/method.py
new file mode 100644
index 000000000..ce01afc6b
--- /dev/null
+++ b/integration/tests_ok/method.py
@@ -0,0 +1,81 @@
+from app import app
+
+
+@app.route("/methods/get")
+def method_get():
+ return ""
+
+
+@app.route("/methods/head")
+def method_head():
+ return ""
+
+
+@app.route("/methods/post", methods=["POST"])
+def method_post():
+ return ""
+
+
+@app.route("/methods/put", methods=["PUT"])
+def method_put():
+ return ""
+
+
+@app.route("/methods/delete", methods=["DELETE"])
+def method_delete():
+ return ""
+
+
+@app.route("/methods/connect", methods=["CONNECT"])
+def method_connect():
+ return ""
+
+
+@app.route("/methods/options", methods=["OPTIONS"])
+def method_options():
+ return ""
+
+
+@app.route("/methods/trace", methods=["TRACE"])
+def method_trace():
+ return ""
+
+
+@app.route("/methods/patch", methods=["PATCH"])
+def method_patch():
+ return ""
+
+
+@app.route("/methods/link", methods=["LINK"])
+def method_link():
+ return ""
+
+
+@app.route("/methods/unlink", methods=["UNLINK"])
+def method_unlink():
+ return ""
+
+
+@app.route("/methods/purge", methods=["PURGE"])
+def method_purge():
+ return ""
+
+
+@app.route("/methods/lock", methods=["LOCK"])
+def method_lock():
+ return ""
+
+
+@app.route("/methods/unlock", methods=["UNLOCK"])
+def method_unlock():
+ return ""
+
+
+@app.route("/methods/propfind", methods=["PROPFIND"])
+def method_propfind():
+ return ""
+
+
+@app.route("/methods/view", methods=["VIEW"])
+def method_view():
+ return ""
diff --git a/packages/hurl/src/http/client.rs b/packages/hurl/src/http/client.rs
index 5f2575782..aca07dcbb 100644
--- a/packages/hurl/src/http/client.rs
+++ b/packages/hurl/src/http/client.rs
@@ -385,17 +385,9 @@ impl Client {
/// Sets HTTP method.
fn set_method(&mut self, method: &Method) {
- match method {
- Method::Get => self.handle.custom_request("GET").unwrap(),
- Method::Post => self.handle.custom_request("POST").unwrap(),
- Method::Put => self.handle.custom_request("PUT").unwrap(),
- Method::Head => self.handle.custom_request("HEAD").unwrap(),
- Method::Delete => self.handle.custom_request("DELETE").unwrap(),
- Method::Connect => self.handle.custom_request("CONNECT").unwrap(),
- Method::Options => self.handle.custom_request("OPTIONS").unwrap(),
- Method::Trace => self.handle.custom_request("TRACE").unwrap(),
- Method::Patch => self.handle.custom_request("PATCH").unwrap(),
- }
+ self.handle
+ .custom_request(method.to_string().as_str())
+ .unwrap()
}
/// Sets HTTP headers.
diff --git a/packages/hurl/src/http/request_spec.rs b/packages/hurl/src/http/request_spec.rs
index d598c3f18..43edc2c26 100644
--- a/packages/hurl/src/http/request_spec.rs
+++ b/packages/hurl/src/http/request_spec.rs
@@ -45,6 +45,13 @@ pub enum Method {
Options,
Trace,
Patch,
+ Link,
+ Unlink,
+ Purge,
+ Lock,
+ Unlock,
+ Propfind,
+ View,
}
#[derive(Clone, Debug, PartialEq, Eq)]
@@ -97,6 +104,13 @@ impl fmt::Display for Method {
Method::Options => "OPTIONS",
Method::Trace => "TRACE",
Method::Patch => "PATCH",
+ Method::Link => "LINK",
+ Method::Unlink => "UNLINK",
+ Method::Purge => "PURGE",
+ Method::Lock => "LOCK",
+ Method::Unlock => "UNLOCK",
+ Method::Propfind => "PROPFIND",
+ Method::View => "VIEW",
};
write!(f, "{}", value)
}
diff --git a/packages/hurl/src/http/request_spec_curl_args.rs b/packages/hurl/src/http/request_spec_curl_args.rs
index f2432af98..122b2672b 100644
--- a/packages/hurl/src/http/request_spec_curl_args.rs
+++ b/packages/hurl/src/http/request_spec_curl_args.rs
@@ -126,12 +126,7 @@ impl Method {
vec!["-X".to_string(), "POST".to_string()]
}
}
- Method::Put => vec!["-X".to_string(), "PUT".to_string()],
- Method::Delete => vec!["-X".to_string(), "DELETE".to_string()],
- Method::Connect => vec!["-X".to_string(), "CONNECT".to_string()],
- Method::Options => vec!["-X".to_string(), "OPTIONS".to_string()],
- Method::Trace => vec!["-X".to_string(), "TRACE".to_string()],
- Method::Patch => vec!["-X".to_string(), "PATCH".to_string()],
+ _ => vec!["-X".to_string(), self.to_string()],
}
}
}
diff --git a/packages/hurl/src/runner/request.rs b/packages/hurl/src/runner/request.rs
index 0f8b75241..a8f51b630 100644
--- a/packages/hurl/src/runner/request.rs
+++ b/packages/hurl/src/runner/request.rs
@@ -173,6 +173,13 @@ fn eval_method(method: &Method) -> http::Method {
Method::Options => http::Method::Options,
Method::Trace => http::Method::Trace,
Method::Patch => http::Method::Patch,
+ Method::Link => http::Method::Link,
+ Method::Unlink => http::Method::Unlink,
+ Method::Purge => http::Method::Purge,
+ Method::Lock => http::Method::Lock,
+ Method::Unlock => http::Method::Unlock,
+ Method::Propfind => http::Method::Propfind,
+ Method::View => http::Method::View,
}
}
diff --git a/packages/hurl_core/src/ast/core.rs b/packages/hurl_core/src/ast/core.rs
index 44712a006..4ca2ccf74 100644
--- a/packages/hurl_core/src/ast/core.rs
+++ b/packages/hurl_core/src/ast/core.rs
@@ -138,6 +138,13 @@ pub enum Method {
Options,
Trace,
Patch,
+ Link,
+ Unlink,
+ Purge,
+ Lock,
+ Unlock,
+ Propfind,
+ View,
}
#[derive(Clone, Debug, PartialEq, Eq)]
diff --git a/packages/hurl_core/src/ast/display.rs b/packages/hurl_core/src/ast/display.rs
index 4585a792e..9d28f7a3c 100644
--- a/packages/hurl_core/src/ast/display.rs
+++ b/packages/hurl_core/src/ast/display.rs
@@ -30,6 +30,13 @@ impl fmt::Display for Method {
Method::Options => "OPTIONS",
Method::Trace => "TRACE",
Method::Patch => "PATCH",
+ Method::Link => "LINK",
+ Method::Unlink => "UNLINK",
+ Method::Purge => "PURGE",
+ Method::Lock => "LOCK",
+ Method::Unlock => "UNLOCK",
+ Method::Propfind => "PROPFIND",
+ Method::View => "VIEW",
};
write!(f, "{}", s)
}
diff --git a/packages/hurl_core/src/error/mod.rs b/packages/hurl_core/src/error/mod.rs
index fa0c954e4..b8555b165 100644
--- a/packages/hurl_core/src/error/mod.rs
+++ b/packages/hurl_core/src/error/mod.rs
@@ -68,9 +68,9 @@ impl Error for parser::Error {
match self.inner.clone() {
ParseError::Method { name }
=> format!("the HTTP method is not valid. {}", did_you_mean(
- &["GET", "HEAD", "POST", "PUT", "DELETE", "CONNECT", "OPTIONS", "TRACE", "PATCH"],
+ &["GET", "HEAD", "POST", "PUT", "DELETE", "CONNECT", "OPTIONS", "TRACE", "PATCH", "LINK", "UNLINK", "PURGE", "LOCK", "UNLOCK", "PROPFIND", "VIEW"],
name.as_str(),
- "Available HTTP Methods are GET, HEAD, POST, PUT, DELETE, CONNECT, OPTIONS, TRACE or PATCH",
+ "Valid values are GET, HEAD, POST, PUT, DELETE, CONNECT, OPTIONS, TRACE, PATCH, LINK, UNLINK, PURGE, LOCK, UNLOCK, PROPFIND or VIEW",
)),
ParseError::Version { .. } => "HTTP version must be HTTP, HTTP/1.0, HTTP/1.1 or HTTP/2".to_string(),
ParseError::Status { .. } => "HTTP status code is not valid".to_string(),
@@ -79,9 +79,9 @@ impl Error for parser::Error {
ParseError::Space { .. } => "expecting a space".to_string(),
ParseError::RequestSectionName { name }
=> format!("the section is not valid. {}", did_you_mean(
- &["QueryStringParams", "FormParams", "MultipartFormData", "Cookies"],
+ &["QueryStringParams", "FormParams", "MultipartFormData", "Cookies", "Options"],
name.as_str(),
- "Valid values are QueryStringParams, FormParams, MultipartFormData or Cookies",
+ "Valid values are QueryStringParams, FormParams, MultipartFormData, Cookies or Options",
)),
ParseError::ResponseSectionName { name }
=> format!("the section is not valid. {}", did_you_mean(
diff --git a/packages/hurl_core/src/parser/parsers.rs b/packages/hurl_core/src/parser/parsers.rs
index 7ccd4a95f..917317ee2 100644
--- a/packages/hurl_core/src/parser/parsers.rs
+++ b/packages/hurl_core/src/parser/parsers.rs
@@ -135,7 +135,7 @@ fn method(reader: &mut Reader) -> ParseResult<'static, Method> {
}
let start = reader.state.clone();
let name = reader.read_while(|c| c.is_alphanumeric());
- let available_methods = vec![
+ let available_methods = [
("GET", Method::Get),
("HEAD", Method::Head),
("POST", Method::Post),
@@ -145,9 +145,16 @@ fn method(reader: &mut Reader) -> ParseResult<'static, Method> {
("OPTIONS", Method::Options),
("TRACE", Method::Trace),
("PATCH", Method::Patch),
+ ("LINK", Method::Link),
+ ("UNLINK", Method::Unlink),
+ ("PURGE", Method::Purge),
+ ("LOCK", Method::Lock),
+ ("UNLOCK", Method::Unlock),
+ ("PROPFIND", Method::Propfind),
+ ("VIEW", Method::View),
];
- for (s, method) in available_methods {
+ for (s, method) in available_methods.into_iter() {
if name == s {
return Ok(method);
}