Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help - How to access request body in post request? #24

Open
jhrdt opened this issue Jan 25, 2022 · 0 comments
Open

Help - How to access request body in post request? #24

jhrdt opened this issue Jan 25, 2022 · 0 comments

Comments

@jhrdt
Copy link

jhrdt commented Jan 25, 2022

Hi,

Dump

POST /api/customer/show HTTP/1.1

HTTP/1.1 200 OK
Content-Type: application/json

{
    "id": "${request.body}",
    "name": "Name"
}

Request

http localhost:9999/api/customer/show  id=1
POST /api/customer/show HTTP/1.1
Host: localhost:9999
User-Agent: HTTPie/1.0.3
Accept-Encoding: gzip, deflate
Accept: application/json, */*
Connection: keep-alive
Content-Type: application/json
Content-Length: 11

{"id": "1"}
--------------------------------------------------------------------------------
HTTP/1.1 200 OK
Content-Type: application/json
Server: DeepfakeHTTP v6.4.2 (2022-01-23 14:42:00)
Content-Length: 48
ETag: "85fffc49"

{
    "id": "{"id": "1"}",
    "name": "Name"
}

Expectation

Response:

{
    "id": "1",
    "name": "Name"
}

Question

What do I need to do, if I want to access the "id" key in the request body?

I tried "id": "${request.body.id}" but this returns "id": "undefined".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant