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
7.91k stars 505 forks source link

JSON Payload interpreted incorrectly when using post #2801

Open kanso-git opened 3 months ago

kanso-git commented 3 months ago

I've noticed that the JSON payload gets deformed, especially when there is a dot in a JSON key.

Version info: ^2.0.12

I expected this JSON payload to be sent:

{
   "title":"Customer Operations Agent",
   "body":"Product",
   "userId":1,
   "metadata":{
      "eperson.firstname":[
         {
            "value":"Raul"
         }
      ],
      "eperson.lastname":[
         {
            "value":"Pfannerstill"
         }
      ]
   }
}

When I called my post with the below json payload

      - post:
          url: '/posts'
          json:
             title: '{{title}}'
             body: '{{body}}'
             userId: '{{userId}}'
             metadata:
                 "eperson.firstname":
                    - value: '{{firstName}}'
                 "eperson.lastname":
                    - value: '{{lastName}}'

However, the keys "eperson.firstname" and "eperson.lastname" were interpreted incorrectly and thus transformed to the below

{
   "title":"Customer Operations Agent",
   "body":"Product",
   "userId":1,
   "metadata":{
      "eperson.firstname":[
         {
            "value":"Raul"
         }
      ],
      "eperson.lastname":[
         {
            "value":"Pfannerstill"
         }
      ],
      "eperson":{
         "firstname":[
            {
               "value":"Raul"
            }
         ],
         "lastname":[
            {
               "value":"Pfannerstill"
            }
         ]
      }
   }
}
kanso-git commented 3 months ago

same case : https://github.com/artilleryio/artillery/issues/879