You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`request.method`is a required child node to define a valid [HTTP request method](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods). All defined methods are `GET`, `POST`, `PUT`, `PATCH`, `DELETE`, `OPTIONS`, `HEAD`. It is also possible to use any custom method server recognizes.
144
145
145
-
```yml
146
+
```yml {3}
146
147
request:
148
+
url: https://httpbin.org/get
147
149
method: OPTIONS
148
150
```
149
151
@@ -153,20 +155,26 @@ request:
153
155
154
156
E.g. the following block represents `https://httpbin.org/get?sort_by=projects&sort_order=DESC` URL.
155
157
156
-
```yml
158
+
```yml {4-6}
157
159
request:
158
160
url: https://httpbin.org/get
161
+
159
162
url_params:
160
163
sort_by: "projects"
161
164
sort_order: "DESC"
165
+
166
+
method: OPTIONS
162
167
```
163
168
164
169
### `request.headers`
165
170
166
171
`request.headers`is a child node to define a set of request headers. It only supports YAML maps, where both keys and values scaler values.
167
172
168
-
```yml
173
+
```yml {5-8}
169
174
request:
175
+
url: https://httpbin.org/get
176
+
method: GET
177
+
170
178
headers:
171
179
User-Agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36"
172
180
Accept-Encoding: "gzip, deflate"
@@ -179,117 +187,171 @@ request:
179
187
180
188
Here only `username` and `password` is supported. Adding any other value to it is expected to be fruitless.
181
189
182
-
```yml
190
+
```yml {10-12}
183
191
request:
192
+
url: https://httpbin.org/get
193
+
method: GET
194
+
195
+
headers:
196
+
User-Agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36"
197
+
Accept-Encoding: "gzip, deflate"
198
+
Accept: "*/*"
199
+
184
200
auth[basic]:
185
201
username: admin
186
202
password: "test1234"
187
203
```
188
204
189
-
:::note
190
-
191
-
Document having `request.auth[bearer]` defined already along with this block will behave unexpectedly.
192
-
193
-
:::
194
-
:::info
205
+
::::info
195
206
196
207
This is same as writing following
197
208
198
-
```yml
209
+
```yml {9}
199
210
request:
211
+
url: https://httpbin.org/get
212
+
method: GET
213
+
200
214
headers:
215
+
User-Agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36"
216
+
Accept-Encoding: "gzip, deflate"
217
+
Accept: "*/*"
201
218
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
202
219
```
220
+
:::note
221
+
222
+
HTTP spec. document having both `request.auth[bearer]` and `request.auth[basic]` on same file will behave unexpectedly.
203
223
204
224
:::
205
225
226
+
::::
227
+
206
228
### `request.auth[bearer]`
207
229
208
230
`request.auth[bearer]`is a child node to send a [bearer authentication](https://dev.writer.com/docs/authentication) token with the request.
209
231
210
232
Here only `token` is supported. Adding any other value to it is expected to be fruitless.
211
233
212
-
```yml
234
+
```yml {10-11}
213
235
request:
236
+
url: https://httpbin.org/get
237
+
method: GET
238
+
239
+
headers:
240
+
User-Agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36"
HTTP spec. document having both `request.auth[bearer]` and `request.auth[basic]` on same file will behave unexpectedly.
232
266
233
267
:::
234
268
269
+
::::
270
+
235
271
### `request.body[form]`
236
272
237
-
`request.body[form]`is a child node to submit a plain html form. This adds `application/x-www-form-urlencoded` form `enctype` in request header.
273
+
`request.body[form]`is a child node of `request:` to submit a plain html form. This adds `application/x-www-form-urlencoded` form `enctype` in request header.
238
274
239
-
It only supports key value data, where both key and value should be scaler values. Request will only submit scaler form data while using `request.body[form]`.
275
+
It only supports key value data, where both key and value should be scaler values. Request will only submit scaler form data, when using `request.body[form]`.
240
276
241
-
:::info
242
-
You can override `Content-Type` headers if you want, however that will override `Content-Type: application/x-www-form-urlencoded` header which is automatically set.
277
+
```yml {9-12}
278
+
request:
279
+
url: https://httpbin.org/post
280
+
method: POST
243
281
244
-
Given a path to a file will not upload the file.
245
-
:::
282
+
headers:
283
+
Accept-Encoding: "gzip, deflate"
284
+
Accept: "*/*"
246
285
247
-
```yml
248
-
request:
249
286
body[form]:
250
287
"var 1": "var str 1"
251
288
var-2: "var str 2"
252
289
var_3: file:///home/username/.vimrc
253
290
```
291
+
:::note
292
+
You can override `Content-Type` headers if you want, however that will override `Content-Type: application/x-www-form-urlencoded` header which is automatically set.
293
+
294
+
Given a path to a file will not upload the file.
295
+
:::
254
296
255
297
### `request.body[form-data]`
256
298
257
-
`request.body[form-data]`is a child node to submit a multipart html form. This adds `multipart/form-data` form `enctype` in request header.
299
+
`request.body[form-data]`is a child node of `request` to submit a multipart html form. This adds `multipart/form-data` form `enctype` in request header.
258
300
259
301
It only supports key value data, where both key and value should be scaler values. Request will submit multipart form data while using `request.body[form-data]`.
260
302
261
-
:::info
262
-
263
-
You can override `Content-Type` headers if you want, however that will override `Content-Type: multipart/form-data` header which is automatically set.
264
-
265
-
Given a path to a file will upload the file. Note, that you can upload files in this way. Please follow [this section on wikipedia](https://en.wikipedia.org/wiki/File_URI_scheme#Examples) on `file://` to set path on different OS platform.
You can override `Content-Type` headers if you want, however that will override `Content-Type: multipart/form-data` header which is automatically set.
321
+
322
+
Given a path to a file will upload the file. Note, that you can upload files in this way. Please follow [this section on wikipedia](https://en.wikipedia.org/wiki/File_URI_scheme#Examples) on `file://` to set path on different OS platform.
323
+
324
+
:::
277
325
278
326
### `request.body[text]`
279
327
280
328
`request.body[text]`is a child node to submit a plain text. This adds `text/plain` form `enctype`in request header.
281
329
282
330
It only supports string. Multiple line of string is also supported.
283
331
284
-
```yml
332
+
```yml {9}
285
333
request:
334
+
url: https://httpbin.org/post
335
+
method: POST
336
+
337
+
headers:
338
+
Accept-Encoding: "gzip, deflate"
339
+
Accept: "*/*"
340
+
286
341
body[text]: Some plain text here
287
342
```
288
343
289
344
or can set multiline text. i.e:
290
345
291
-
```yml
346
+
```yml {9-11}
292
347
request:
348
+
url: https://httpbin.org/post
349
+
method: POST
350
+
351
+
headers:
352
+
Accept-Encoding: "gzip, deflate"
353
+
Accept: "*/*"
354
+
293
355
body[text]: |
294
356
Some plain text here
295
357
Other line here
@@ -301,8 +363,15 @@ request:
301
363
302
364
It supports key value data, where key should be scaler, and value can be of YAML collection type those are convertible to json.
0 commit comments