Skip to content

Commit 11efdbf

Browse files
committed
Merge branch 'feat/query-http-method'
2 parents a60ea32 + cea1958 commit 11efdbf

5 files changed

Lines changed: 73 additions & 2 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ cargo run -- -h
168168
| Methods | :white_check_mark: | :white_check_mark: | :white_check_mark: |
169169
| - GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
170170
| - POST | :white_check_mark: | :white_check_mark: | :white_check_mark: |
171+
| - QUERY | :white_check_mark: | :x: | :x: |
171172
| - PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |
172173
| - PATCH | :white_check_mark: | :white_check_mark: | :white_check_mark: |
173174
| - DELETE | :white_check_mark: | :white_check_mark: | :white_check_mark: |

‎example_resources/collections/HTTP_methods.json‎

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,67 @@
133133
}
134134
}
135135
},
136+
{
137+
"name": "Test Query",
138+
"url": "https://httpbin.org",
139+
"params": [],
140+
"headers": [
141+
{
142+
"enabled": true,
143+
"data": [
144+
"cache-control",
145+
"no-cache"
146+
]
147+
},
148+
{
149+
"enabled": true,
150+
"data": [
151+
"user-agent",
152+
"ATAC/v0.23.0"
153+
]
154+
},
155+
{
156+
"enabled": true,
157+
"data": [
158+
"accept",
159+
"*/*"
160+
]
161+
},
162+
{
163+
"enabled": true,
164+
"data": [
165+
"accept-encoding",
166+
"gzip, deflate, br"
167+
]
168+
},
169+
{
170+
"enabled": true,
171+
"data": [
172+
"connection",
173+
"keep-alive"
174+
]
175+
}
176+
],
177+
"auth": "no_auth",
178+
"scripts": {
179+
"pre_request_script": null,
180+
"post_request_script": null
181+
},
182+
"settings": {
183+
"use_config_proxy": true,
184+
"allow_redirects": true,
185+
"timeout": 30000,
186+
"store_received_cookies": true,
187+
"pretty_print_response_content": true,
188+
"accept_invalid_certs": false,
189+
"accept_invalid_hostnames": false
190+
},
191+
"protocol": {
192+
"type": "http",
193+
"method": "QUERY",
194+
"body": "no_body"
195+
}
196+
},
136197
{
137198
"name": "Test Put",
138199
"url": "https://httpbin.org/put",

‎src/app/files/theme.rs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ nest! {
4949
pub get: Color,
5050
#[serde(alias = "POST")]
5151
pub post: Color,
52+
#[serde(alias = "QUERY")]
53+
pub query: Color,
5254
#[serde(alias = "PUT")]
5355
pub put: Color,
5456
#[serde(alias = "PATCH")]
@@ -118,6 +120,7 @@ impl Default for Theme {
118120
methods: ThemeMethods {
119121
get: Color::Green,
120122
post: Color::Yellow,
123+
query: Color::LightGreen,
121124
put: Color::LightBlue,
122125
patch: Color::LightCyan,
123126
delete: Color::LightRed,

‎src/cli/commands/request_commands/method.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub enum MethodCommand {
88

99
/// Set the request method
1010
Set {
11-
/// Method (GET, POST, PUT, PATCH, DELETE, HEAD, OPTION)
11+
/// Method (GET, POST, QUERY, PUT, PATCH, DELETE, OPTIONS, HEAD, TRACE, CONNECT)
1212
new_method: Method
1313
}
1414
}

‎src/models/protocol/http/method.rs‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ pub enum Method {
1010
GET,
1111
#[strum(to_string = "POST")]
1212
POST,
13+
#[strum(to_string = "QUERY")]
14+
QUERY,
1315
#[strum(to_string = "PUT")]
1416
PUT,
1517
#[strum(to_string = "PATCH")]
@@ -33,6 +35,7 @@ impl Method {
3335
match self {
3436
Method::GET => theme.http.methods.get,
3537
Method::POST => theme.http.methods.post,
38+
Method::QUERY => theme.http.methods.query,
3639
Method::PUT => theme.http.methods.put,
3740
Method::PATCH => theme.http.methods.patch,
3841
Method::DELETE => theme.http.methods.delete,
@@ -47,6 +50,8 @@ impl Method {
4750
match self {
4851
Method::GET => reqwest::Method::GET,
4952
Method::POST => reqwest::Method::POST,
53+
// TODO: Remove when Reqwest supports the QUERY method
54+
Method::QUERY => reqwest::Method::from_bytes(b"QUERY").expect("QUERY is a valid HTTP method token"),
5055
Method::PUT => reqwest::Method::PUT,
5156
Method::PATCH => reqwest::Method::PATCH,
5257
Method::DELETE => reqwest::Method::DELETE,
@@ -61,7 +66,8 @@ impl Method {
6166
pub fn next_method(method: &Method) -> Method {
6267
match method {
6368
&Method::GET => Method::POST,
64-
&Method::POST => Method::PUT,
69+
&Method::POST => Method::QUERY,
70+
&Method::QUERY => Method::PUT,
6571
&Method::PUT => Method::PATCH,
6672
&Method::PATCH => Method::DELETE,
6773
&Method::DELETE => Method::OPTIONS,

0 commit comments

Comments
 (0)