Closed Monirzadeh closed 1 month ago
Hi @Monirzadeh I have tried to reproduce this issue with no success. could you please share your request yaml file? on linux its in ~/.config/chapar
and should be something like this:
apiVersion: v1
kind: Request
metadata:
id: 56da73ac-92ff-4dc7-b95a-596dc411155d
name: Login
type: http
spec:
http:
method: POST
url: '{{baseURL}}/login'
lastUsedEnvironment:
id: ""
name: ""
request:
headers:
- id: ddabdf74-a330-496b-87e7-c5653738b506
key: Content-Type
value: application/json
enable: true
pathParams: []
queryParams: []
body:
type: json
data: |
{
"email": "{{email}}",
"password": "{{password}}"
}
auth:
type: none
preRequest:
type: none
script: ""
postRequest:
type: setEnv
set:
target: authenticationToken
statusCode: 200
from: responseBody
fromKey: $.authenticationToken
responses: []
apiVersion: v1
kind: Request
metadata:
id: 5ff95cdf-6f02-41b8-9b85-46a0dfcd9e50
name: Login
type: http
spec:
http:
method: POST
url: http://myurl/api/v1/auth/login
lastUsedEnvironment:
id: ""
name: ""
request:
headers:
- id: ""
key: Content-Type
value: application/json
enable: true
pathParams: []
queryParams: []
body:
type: json
data: |-
{
"password": "whatever",
"remember_me": true,
"username": "username"
}
auth:
type: None
preRequest:
type: None
script: ""
postRequest:
type: setEnv
script: ""
set:
target: TokenKey
statusCode: 200
from: responseBody
fromKey: message.token
responses: []
it is the yaml version of request under collection directory
first different I can notice is fromKey
. please change it to fromKey: $.message.token
. I assume your response is look like flowing, right?
{
"message": {
"token": "xyz"
}
}
first different I can notice is
fromKey
. please change it tofromKey: $.message.token
.
I change that but problem still exist.
I assume your response is look like flowing, right?
{ "message": { "token": "xyz" } }
Yes
Hi Why close this issue. Does it solve?
Hi @Monirzadeh I really like to help but I did more tests on this with a fresh setup and to this point the latest build is always working so I can’t confirm this issue.
If any one else sees this issue please let me know to open it again.
I would appreciate If you could send some screenshots, that might help me to understand what is wrong 🙏
i try to use Post Request and get token with this
i see token in preview section but when i want use
{{TokenKey}}
in header of of other request it is not working. did i miss something? i can't find documentation how to use Post Request feature.Originally posted by @Monirzadeh in https://github.com/chapar-rest/chapar/discussions/58