The vscode extension vscode-restclient allows to create http request and handle the response similar to curl or postman.
A POST request to /sales/getResult/
returns this response
HTTP/1.1 200 OK
Date: ....
Content-Type: text/plain; charset=utf-8
Content-Length: 67
Connection: close
Load your results with ID: CJoYTvh8
From the body we need the id CJoYTvh8
to get details. The request to get details goes to the URL /sales/GetResult/{{resultId}}
. Where {{resultId}}
stands for the ID CJoYTvh8
from the previous response body.
I want to create the request for the details which needs to look like this
@resultId = {{myRequest.response.body}} // this should only be CJoYTvh8
# @name getResult_for_id
POST /sales/getResult/{{resultId}} HTTP/1.1
Host: {{our_host}}
Authorization: Bearer {{authToken}}
Content-Type: application/json
I am looking for something like this
@resultId = response.body.split(':')[1].trim()
Question
How can i split the string Load your results with ID: CJoYTvh8
in vscode-restclient so that i assign only the id CJoYTvh8
to the variable @resultId
?