should.js http assertions
This module can be usefull for asserting on node standard http
modele request and response.
Install
npm install should-http --save-dev
require('should-http');
That row patch your should instance adding assertions. With mocha you can use it via -r
switch.
.status(code)
Asserts that .statusCode
is code
:
resshouldhavestatus200;
.header(field[, value])
Asserts that a .headers
object with field
and optional value
are present:
resshouldhave;resshouldhave;
.json
Assert that Content-Type is "application/json; charset=utf-8"
resshouldbejson
.html
Assert that Content-Type is "text/html; charset=utf-8"
resshouldbehtml