smicyk / groovy-jmeter

A Groovy-based DSL for building and running JMeter test plans from command line and more.
Apache License 2.0
13 stars 1 forks source link

[Q] POST Text instead of Params #74

Closed AntonioSun closed 2 years ago

AntonioSun commented 2 years ago

Following up on #71, here is another POST outlier.

First of all, here is a sample of normal POST in a .har file:

image

The POST has Params in PostData.

Now,

image

This one, The POST has Text in PostData instead.

How to send such Text in POST?

Would that be something like this?

            http('POST /url/...') {
                body "POST Text here"
            }
smicyk commented 2 years ago

Hi, if POST request is not form data you just use body to sent any data with the POST. Remember that you need to set header with Content-Type 'application/json'.

I don't know if you try but https://github.com/smicyk/groovy-harventer but it converts .har to groovy files. It should handle it I hope at least.

AntonioSun commented 2 years ago

Thank you for all your answers.