chai-http icon indicating copy to clipboard operation
chai-http copied to clipboard

feat: status assert now outputs status code number and text

Open orcun-gokbulut opened this issue 5 years ago • 0 comments

Hello,

First of all, thanks for the chai-http.

I have modified status assert error output to print status code as text as well as number. I've also modified tests and test are running fine.

However, I had to add http-status-codes package as new dependency in order to convert status code number to string.

Old behavior;

      AssertionError: expected { Object (_events, _eventsCount, ...) } to have status code 200 but got 400
      + expected - actual

      -400
      +200

New behavior;

      AssertionError: expected { Object (_events, _eventsCount, ...) } to have status code '200 (OK)' but got '400 (Bad Request)'
      + expected - actual

      -400 (Bad Request)
      +200 (OK)

I've bored of to look up status codes on google so i guess this is a good feature to have.

Have a nice day, Orcun

orcun-gokbulut avatar Sep 09 '20 18:09 orcun-gokbulut