包详细信息

should-http

shouldjs56.7kMIT0.1.1

Http requests, response assertions for should.js

should, should.js, http

自述文件

should.js http assertions

Build Status

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:

res.should.have.status(200);

.header(field[, value])

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

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

.json

Assert that Content-Type is "application/json; charset=utf-8"

res.should.be.json

.html

Assert that Content-Type is "text/html; charset=utf-8"

res.should.be.html

更新日志

0.1.1 / 2017-02-06

  • Provide alternative browser entry without nodejs staff

0.1.0 / 2017-02-06

  • .xml() assertion to test res Content-Type to be application/xml
  • .contentType(type, charset) now used for every content type assertions
  • formatter for http.IncomingMessage

0.0.3 / 2015-05-21

  • .status() will show only body and statusCode

0.0.2 / 2014-05-29

  • Fix for current should.js version

0.0.1 / 2014-05-29

  • Move this thing to separate repo