should-http
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -0,1 +1,6 @@ | ||
0.1.1 / 2017-02-06 | ||
================== | ||
* Provide alternative browser entry without nodejs staff | ||
0.1.0 / 2017-02-06 | ||
@@ -2,0 +7,0 @@ ================== |
28
http.js
@@ -9,34 +9,6 @@ /* | ||
var contentType = require('content-type'); | ||
var http = require('http'); | ||
module.exports = function(should, Assertion) { | ||
var i = should.format; | ||
var t = should.modules.type; | ||
var format = should.modules.format; | ||
var NODE_HTTP_INCOMMING_MESSAGE = new t.Type(t.OBJECT, 'node-http-incomming-message'); | ||
t.checker.addBeforeFirstMatch({}, function(obj) { | ||
if (obj instanceof http.IncomingMessage) { | ||
return NODE_HTTP_INCOMMING_MESSAGE; | ||
} | ||
}); | ||
var FIELDS = { | ||
headers: true, | ||
httpVersion: true, | ||
method: true, | ||
statusCode: true, | ||
url: true, | ||
body: true | ||
}; | ||
format.Formatter.addType(NODE_HTTP_INCOMMING_MESSAGE, function(value) { | ||
return format.formatPlainObject.call(this, value, { | ||
filterKey: function(key) { | ||
return key in FIELDS; | ||
} | ||
}); | ||
}); | ||
/** | ||
@@ -43,0 +15,0 @@ * Asserts given object has property headers which contain `field` and optional `val`. Will work well with node Request/Response etc. |
@@ -1,1 +0,1 @@ | ||
require('should').use(require('./http')); | ||
require('should').use(require('./http')).use(require('./http-node')); |
{ | ||
"name": "should-http", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Http requests, response assertions for should.js", | ||
"main": "index.js", | ||
"browser": "index-browser.js", | ||
"scripts": { | ||
@@ -25,4 +26,6 @@ "test": "mocha --reporter mocha-better-spec-reporter test/**.test.js" | ||
"devDependencies": { | ||
"eslint": "^3.18.0", | ||
"eslint-config-shouldjs": "^1.0.2", | ||
"mocha": "latest", | ||
"mocha-better-spec-reporter": "latest", | ||
"mocha": "latest", | ||
"should": "latest" | ||
@@ -29,0 +32,0 @@ }, |
10191
13
244
5