Skip to content

Commit 4477438

Browse files
committed
draft
1 parent 99303ab commit 4477438

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

aspnetcore/test/http-files.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,20 +210,30 @@ You can pass values from one HTTP request to another within the same `.http` fil
210210
1. Use the following syntax to extract the specific part of the response that you want.
211211

212212
```http
213-
{{<request name>.(response|request).(body|headers).(*|JSONPath|XPath|Header Name)}}.
213+
{{<request name>.(response|request).(body|headers).(*|JSONPath|XPath|<header name>)}}.
214214
```
215215

216-
You can extract values from the request itself or from the response to it (`request|response`). For either request or response, you can extract values from the body or the headers (`body|headers`).
216+
This syntax lets you extract values from the request itself or from the response to it (`request|response`). For either request or response, you can extract values from the body or the headers (`body|headers`).
217217

218-
For the body (`*|JSONPath|XPath`):
218+
When `body` is selected, the `*|JSONPath|XPath` part of the syntax applies:
219219

220220
* `*` extracts the entire response body.
221+
222+
Example: `{{login.response.body.*}}`
223+
221224
* For JSON responses, use [JSONPath](https://www.rfc-editor.org/rfc/rfc9535.html) to extract a specific property or attribute.
225+
226+
Example: `{{login.response.body.$.token}}`
227+
222228
* For XML responses, use [XPath](https://www.w3schools.com/xml/xpath_syntax.asp) to extract a specific property or attribute.
223229

224-
Header name extracts the entire header. Header names are case-insensitive.
230+
Example: `{{login.response.body./token}}`
231+
232+
When `headers` is selected, a header name extracts the entire header. Header names are case-insensitive.
233+
234+
Example: `{{login.response.headers.Location}}`
225235

226-
If you want to refer to the response of a named request, you need to manually trigger the named request to retrieve its response first. When you extract from the response, you'll get the latest response if the request has been sent more than once.
236+
If you want to refer to the response of a named request, you need to manually trigger the named request to retrieve its response first. When you extract values from the response, you'll get the latest response if the request has been sent more than once.
227237

228238
### Example request variable usage
229239

0 commit comments

Comments
 (0)