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
Copy file name to clipboardExpand all lines: README.md
+30-3Lines changed: 30 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,9 +24,10 @@ REST Client allows you to send HTTP request and view the response in Visual Stud
24
24
- AWS Signature v4
25
25
* Environments and custom/system variables support
26
26
- Use variables in any place of request(_URL_, _Headers_, _Body_)
27
-
- Support both __environment__, __file__ and __request__ custom variables
27
+
- Support __environment__, __file__, __request__ and __prompt__ custom variables
28
+
- Interactively assign __prompt__ custom variables per request
28
29
- Auto completion and hover support for both __environment__, __file__ and __request__ custom variables
29
-
- Diagnostic support for __request__and __file__ custom variables
30
+
- Diagnostic support for __request__, __file__and __prompt__ custom variables
30
31
- Go to definition support for __request__ and __file__ custom variables
31
32
- Find all references support _ONLY_ for __file__ custom variables
32
33
- Provide system dynamic variables
@@ -413,7 +414,7 @@ Environments give you the ability to customize requests using variables, and you
413
414
Environments and including variables are defined directly in `Visual Studio Code` setting file, so you can create/update/delete environments and variables at any time you wish. If you __DO NOT__ want to use any environment, you can choose `No Environment` in the environment list. Notice that if you select `No Environment`, variables defined in shared environment are still available. See [Environment Variables](#environment-variables) for more details about environment variables.
414
415
415
416
## Variables
416
-
We support two types of variables, one is __Custom Variables__ which is defined by user and can be further divided into __Environment Variables__, __File Variables__ and __Request Variables__, the other is __System Variables__ which is a predefined set of variables out-of-box.
417
+
We support two types of variables, one is __Custom Variables__ which is defined by user and can be further divided into __Environment Variables__, __File Variables__, __Prompt Variables__, and __Request Variables__, the other is __System Variables__ which is a predefined set of variables out-of-box.
417
418
418
419
The reference syntax of system and custom variables types has a subtle difference, for the former the syntax is `{{$SystemVariableName}}`, while for the latter the syntax is `{{CustomVariableName}}`, without preceding `$` before variable name. The definition syntax and location for different types of custom variables are different. Notice that when the same name used for custom variables, request variables takes higher resolving precedence over file variables, file variables takes higher precedence over environment variables.
With prompt variables, user can input the variables to be used when sending a request. This gives a flexibility to change most dynamic variables without having to change the `http` file. User can specify more than one prompt variables. The definition syntax of prompt variables is like a single-line comment by adding the syntax before the desired request url with the following syntax __`// @prompt {var1}`__ or __`# @prompt {var1}`__. A variable description is also assignable using __`// @prompt {var1} {description}`__ or __`# @prompt {var1} {description}`__ which will prompt an input popup with a desired description message.
486
+
487
+
488
+
The reference syntax is the same as others, follows __`{{var}}`__. The prompt variable will override any preceding assigned variable and will never be stored to be used in other requests.
489
+
490
+
```http
491
+
@hostname = api.example.com
492
+
@port = 8080
493
+
@host = {{hostname}}:{{port}}
494
+
@contentType = application/json
495
+
496
+
###
497
+
# @prompt username
498
+
# @prompt refCode Your reference code display on webpage
499
+
# @prompt otp Your one-time password in your mailbox
500
+
POST https://{{host}}/verify-otp/{{refCode}} HTTP/1.1
501
+
Content-Type: {{contentType}}
502
+
503
+
{
504
+
"username": "{{username}}",
505
+
"otp": "{{otp}}"
506
+
}
507
+
508
+
```
509
+
483
510
#### Request Variables
484
511
Request variables are similar to file variables in some aspects like scope and definition location. However, they have some obvious differences. The definition syntax of request variables is just like a single-line comment, and follows __`// @name requestName`__ or __`# @name requestName`__ just before the desired request url. You can think of request variable as attaching a *name metadata* to the underlying request, and this kind of requests can be called with **Named Request**, while normal requests can be called with **Anonymous Request**. Other requests can use `requestName` as an identifier to reference the expected part of the named request or its latest response. Notice that if you want to refer the response of a named request, you need to manually trigger the named request to retrieve its response first, otherwise the plain text of variable reference like `{{requestName.response.body.$.id}}` will be sent instead.
0 commit comments