how to pass json?
See original GitHub issueHello
Im really broke my head trying to pass json to cannon. I want to send application/json
Let me show all cases that im try:
autocannon -m PUT -b "{\"playerId\":\"8797982347\" }" https://localhost:3434/player
autocannon -m PUT -b '{"playerId":"8797982347" }' https://localhost:3434/player
- ofcourse
autocannon -m PUT -b {"playerId":"8797982347" } https://localhost:3434/player
- and many other cases like
--body=
or with--input
.
And also I try more from this with -H "Content-Type: application/json"
Can somebody help me and tell what type of escaping I must use for sending json
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
How to Send and Receive JSON Data to and from the Server
Create a JavaScript object using the standard or literal syntax. · Use JSON.stringify() to convert the JavaScript object into a JSON string. ·...
Read more >How to pass JSON data using HTTP Request action
To add the JSON data in the body of the 'HTTP Request', select 'raw' from the list of options and enter your JSON...
Read more >How to pass a JSON array as a parameter in URL
Take the JSON object and convert it to string (JSON.stringify) · Take the string and encode it in Base64 (you can find some...
Read more >How to send a JSON object to a server using Javascript?
So we are using JSON.stringify() function to convert data to string and send it via XHR request to the server. Below is the...
Read more >How to post JSON data using Curl? - ReqBin
JSON data is passed as a string. Double quotes in JSON must be escaped with the backslash "\" on Windows computers. In this...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi, I found the solution, it is necessary to specify the header so that it accepts the body.
Exemple: URL=http://localhost:3000/api/v1/login
npx autocannon $URL -m POST --header ‘Content-Type: application/json’ --body ‘{“username”: “USER_NAME”,“pass”: “PASS_123”}’ --connections 100 --duration 10 --pipelining 1 --renderStatusCodes
Must admit I can’t get this to work with express either using same variety of options.