mcollina/autocannon

expectBody not working as expected

Open

#457 opened on Jul 29, 2022

View on GitHub
 (11 comments) (0 reactions) (0 assignees)JavaScript (7,425 stars) (332 forks)batch import
bughelp wanted

Description

Hi @mcollina my version "autocannon": "^7.9.0", my codebase

let customResponse= customResponse

  url: 'http://localhost:3011/employees/api/searchtype/',
  amount: 10,
  connections: 1,
  pipelining: 1,
  //duration: 60,
  method: "POST",
  debug: true,
  expectBody: customResponse,
  headers: { "Content-Type": "application/json; charset=UTF-8", 'x-access-token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2NTkxMjMxMTd9.xavjahsbNggTSDBu6Vmsxzz6olPMXHTPggkFForZqaU' },
  body: JSON.stringify(customRequest),

}, (err, result) => {

  console.log(err);
  if (err != null) return; // or do some error handling
  handleResults(result);
})

The response which i am getting from api response is below API Response

and when I compare it http://www.jsondiff.com/ it was identical Problem statement

when i run the above i am getting mismatched results which should not happen if both the customResponse and API Response are identical

Any pointers on how to tackle this issue

Contributor guide