Closed alexwhitman closed 10 years ago
Yep, i do not use this assertions and waiting somebody to use. It does not contain custom message for output like others.
Btw, do you have any suggestion about custom formatting for this response object? I think to show just headers
, what do you think?
I usually do this like
response.should.have.property('headers').which.should.have.properties('content-type', ...)
In the 2.x release only the headers
object was printed. I'd be happy with the same functionality.
I published 3.2.0. It has such message for .header
:
AssertionError: expected { ..., headers: { date: 'Sat, 29 Mar 2014 17:37:48 GMT',
expires: '-1',
'cache-control': 'private, max-age=0',
'content-type': 'text/html; charset=ISO-8859-1',
'set-cookie':
[ 'PREF=ID=f118ed90dd3eb019:FF=0:TM=1396114668:LM=1396114668:S=XukWCeEitHLApGlK; expires=Mon, 28-Mar-2016 17:37:48 GMT; path=/; domain=.google.co.uk',
'NID=67=fY2eqzHYg0bW-9Wi-gB9TiR1ieZKkyeLKMbDPNga7r19KXmc80eEX1GmR10LvHnPW7fLjoYxremBgYtZmsBm91dxOBm3J-NnhiD1LCM-BQa3M4RFPX5G1REYdDiibj0a; expires=Sun, 28-Sep-2014 17:37:48 GMT; path=/; domain=.google.co.uk; HttpOnly' ],
p3p: 'CP="This is not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 for more info."',
server: 'gws',
'x-xss-protection': '1; mode=block',
'x-frame-options': 'SAMEORIGIN',
'alternate-protocol': '80:quic',
'transfer-encoding': 'chunked' }, ... } to have header 'foo'
at Assertion.prop.(anonymous function) (/Users/den/Projects/should.js/lib/should.js:61:14)
Just tested it, looks good to me. Thanks.
Using should 3.1.4, request 2.34.0 with node 0.10.26
the above code prints out the following:
Firstly the object does have a
headers
property asresponse.should.have.header('date');
works fine so the error is wrong, but also printing the entire response object instead of theheaders
object doesn't seem that useful.