Search code examples
jmeterperformance-testingrequest-mappinghttp-request-parameters

How to send PUT request with variable path parameter AND request parameter in the same endpoint with JMeter?


I'm using a Jmeter 5.3, and a need send PUT request with PathVariable AND RequestParam in the same endpoint.

Example:

@RequestMapping(value = "/authorize/{iduser}", method = RequestMethod.PUT)
    public ResponseEntity<Void> authorizeUser(
            @PathVariable Integer iduser,
            @RequestParam(value = "idstore") Integer idstore,
            @RequestParam(value = "typerequest") Integer type)
            { ...

I use a HTTP REQUEST component

PUT -> <URL>/authorize/${iduser}

Parameters:

name      | Value
idstore   | 139
type      | 1

But a receive 400 BAD REQUEST.

{"timestamp":1595881241767,"status":400,"error":"Bad Request",
"message":"Required Integer parameter 'idstore' is not present","path":"/authorize/175"}

any suggestion ?


Solution

  • Put the parameters as part of the path:

    PUT -> <URL>/authorize/${iduser}?idstore=139&typerequest=1
    

    also maybe you need to send Content-type header with application/json