2
votes

The WebAPI request has a POST method which expects Content body. I've tried to use both Parameters and Body options but I receive error responses - 'Invalid Request' with 400 Status code, etc.

JMeter request Sample Content Body:

{
    "ParamA": 111,
    "ParamB": "Char String",
    "ParamC": "VarType"
}

OR

{ "ParamA": 111, "ParamB": "Char String", "ParamC": "VarType"}

Listener Request:

  • POST data: --8vpH3B6WcV4f1La46_wccVi4c25lrLJaGcN--

Listener Response:

  • {"message":"The request is invalid.","modelState":{"value":["An error has occurred."]}}

Any insight into viable options? Eventually, I'm planning on reading the Body string from a .csv file so I can parameterize the request. Reading from a .CSV file only reads the first line of the request body - for example: '{'

Any help would be greatly appreciated.

Best, Ray

HTTP Request

Request

1
Please share the request you are posting.NaveenKumar Namachivayam
Naveen, I've added screenshots of the HTTP request and the request in the listenerRayLoganGop

1 Answers

1
votes

Uncheck in HTTP request the option:

  • Use multipart/form data for POST

Also check your CSV does not contain some data that contains the CSV separator which is '\t' by default.

Ensure it doesn't by changing separator to '|' for example if you're sure your JSON will never contain it.