nearform/autocannon-ui

API not validating when 'connection' parameter is missing in the request

jasleenChauhan opened this issue · 1 comments

Steps to re-produce

Go to Postman and create the below POST request:
URL: http://localhost:3000/api/execute
Body:
{
"url": "https://www.bbc.co.uk/news",
"method": "POST",
"duration": "11",
"pipelining": 1
}

Expected Behaviour: API should validate that connection parameter is missing in the request.

Expected response:

HTTP Status Code: 400

Error code: Bad Request Exception

Response Example:

{
"errorCode": "Bad Request"
"message": "Connection parameter is missing"
}

Observed Behaviour: Received 200 OK status with below response:
{
"url": "https://www.bbc.co.uk/news",
"connections": 10,
"pipelining": 1,
"duration": 11.01,
"start": "2021-05-14T14:31:05.348Z",
"finish": "2021-05-14T14:31:16.360Z",
"errors": 0,
"timeouts": 0,
"mismatches": 0,
"non2xx": 0,
"resets": 0,
"1xx": 0,
"2xx": 310,
"3xx": 0,
"4xx": 0,
"5xx": 0,
"statusCodeStats": {
"200": {
"count": 310
}
},

this is an optional parameter and has a default value if not provided