Http assertions for should.js
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

should.js http assertions

Build Status

This module can be usefull for asserting on node standard http modele request and response.


npm install should-http --save-dev

That row patch your should instance adding assertions. With mocha you can use it via -r switch.

This module have built in formatting for node http IncommingMessage's.


Asserts that .statusCode is code:


.header(field[, value])

Asserts that a .headers object with field and optional value are present:

res.should.have.header('Content-Length', '123');


Assert that Content-Type is "application/json"


Assert that Content-Type is "text/html"


Assert that Content-Type is "application/xml"

.contentType(type [, charset])

Assert that Content-Type is a given type with optional charset