Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub fn help_text() -> String {
[Body]
::send
{}:
GET, POST, PUT, PATCH, DELETE
GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS
{}:
<key>: <value>
param: <key>=<value>
Expand Down
4 changes: 2 additions & 2 deletions src/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use rustyline::validate::Validator;
use rustyline::{Context, Helper, Result};

const BUILTINS: &[&str] = &[
"GET", "POST", "PUT", "PATCH", "DELETE", "base", "header", "exit", "help", "history", "rerun",
"set", "unset", "save", "run", "vars", "headers", "requests",
"GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "base", "header", "exit", "help",
"history", "rerun", "set", "unset", "save", "run", "vars", "headers", "requests",
];

pub struct ShellHelper;
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ fn shell_loop() {
}

let tokens: Vec<&str> = line.split_whitespace().collect();
let methods = ["GET", "POST", "PUT", "PATCH", "DELETE"];
let methods = ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"];
let raw = if methods.contains(&tokens[0]) {
collect_input(&mut rl, line)
} else {
Expand Down
5 changes: 4 additions & 1 deletion src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub fn parse(input: String) -> Result<Parsed, String> {

let token_match = tokens[0].to_lowercase();
match token_match.as_str() {
"get" | "post" | "put" | "patch" | "delete" => {
"get" | "post" | "put" | "patch" | "delete" | "head" | "options" => {
let result = parse_request(input)?;
Ok(Parsed::Request(result))
}
Expand Down Expand Up @@ -53,7 +53,10 @@ fn parse_request(buffer: String) -> Result<Request, String> {
"get" => Method::GET,
"post" => Method::POST,
"put" => Method::PUT,
"patch" => Method::PATCH,
"delete" => Method::DELETE,
"head" => Method::HEAD,
"options" => Method::OPTIONS,
_ => return Err("Invalid Method".to_string()),
};

Expand Down
4 changes: 4 additions & 0 deletions src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ pub enum Method {
PUT,
PATCH,
DELETE,
HEAD,
OPTIONS,
}

impl Method {
Expand All @@ -50,6 +52,8 @@ impl Method {
Method::PUT => "PUT",
Method::PATCH => "PATCH",
Method::DELETE => "DELETE",
Method::HEAD => "HEAD",
Method::OPTIONS => "OPTIONS",
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ pub fn fetch(
Method::PUT => client.put(full_url),
Method::PATCH => client.patch(full_url),
Method::DELETE => client.delete(full_url),
Method::HEAD => client.head(full_url),
Method::OPTIONS => client.request(reqwest::Method::OPTIONS, full_url),
};

//Global Headers
Expand Down
Loading