artilleryio / artillery

The complete load testing platform. Everything you need for production-grade load tests. Serverless & distributed. Load test with Playwright. Load test HTTP APIs, GraphQL, WebSocket, and more. Use any Node.js module.
https://www.artillery.io
Mozilla Public License 2.0
8.03k stars 510 forks source link

Int as a string in the body. #1324

Open matidmarino opened 2 years ago

matidmarino commented 2 years ago

I want to send a numeric string in the json body but artillery converts it to an int. For example:

"post": {
     "url": "xxx",
     "json": {
          "user_id": "{{ user_id }}",

I want user_id be sent as a string and not as a number ("100" instead of 100). I tried a beforeRequest hook to make the conversion and it didn't work.

CostinTanasoiu commented 1 year ago

I get the same behaviour. I even tried with a custom JS function which overwrites that field with a value converted to string, but somehow Artillery still sends it as an INT.

eroSanyn commented 1 year ago

I tried custom js function as well and that didn't work either. But found in the documentation that passing cast: false will not change the type from string to int.

https://www.artillery.io/docs/guides/guides/test-script-reference#payload-file-options