Comparing version 0.2.0 to 0.3.0
@@ -337,3 +337,3 @@ const Request = require('./request'); | ||
} | ||
res.writeHead(500, { 'Content-Type': 'text/plain' }); | ||
res.writeHead(404, { 'Content-Type': 'text/plain' }); | ||
res.end('No Matching Response!\n'); | ||
@@ -340,0 +340,0 @@ } |
@@ -1,1 +0,43 @@ | ||
{"name":"zt-hock","description":"A mocking server for HTTP requests, forked from Hock","version":"0.2.0","author":"Joachim Seminck <joachim@seminck.be>","contributors":[{"name":"Joachim Seminck","email":"joachim@seminck.be"}],"repository":{"type":"git","url":"http://github.com/zeroturnaround/zt-hock.git"},"keywords":["mock","http","test"],"devDependencies":{"babel-eslint":"^7.2.3","eslint":"^4.0.0","eslint-config-zt":"^1.4.0","jest":"19.0.0","request":"^2.81.0"},"main":"./lib/hock","scripts":{"test":"jest","lint":"eslint ."},"dependencies":{"coveralls":"^3.0.0","deep-equal":"0.2.1"},"jest":{"roots":["test"],"testRegex":"-test.js","collectCoverage":true}} | ||
{ | ||
"name": "zt-hock", | ||
"description": "A mocking server for HTTP requests, forked from Hock", | ||
"version": "0.3.0", | ||
"author": "Joachim Seminck <joachim@seminck.be>", | ||
"contributors": [ | ||
{ | ||
"name": "Joachim Seminck", | ||
"email": "joachim@seminck.be" | ||
} | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "http://github.com/zeroturnaround/zt-hock.git" | ||
}, | ||
"keywords": [ | ||
"mock", | ||
"http", | ||
"test" | ||
], | ||
"devDependencies": { | ||
"babel-eslint": "^7.2.3", | ||
"eslint": "^4.0.0", | ||
"eslint-config-zt": "^1.4.0", | ||
"jest": "19.0.0", | ||
"request": "^2.81.0" | ||
}, | ||
"main": "./lib/hock", | ||
"scripts": { | ||
"test": "jest", | ||
"lint": "eslint ." | ||
}, | ||
"dependencies": { | ||
"deep-equal": "0.2.1" | ||
}, | ||
"jest": { | ||
"roots": [ | ||
"test" | ||
], | ||
"testRegex": "-test.js", | ||
"collectCoverage": true | ||
} | ||
} |
@@ -413,2 +413,28 @@ const request = require('request'); | ||
}); | ||
describe("when throwOnUnmatched is set to false", function() { | ||
beforeEach(function(done) { | ||
this.port = createPort(); | ||
this.hockInstance = hock.createHock({throwOnUnmatched: false}); | ||
this.httpServer = createHttpServer(this.hockInstance, this.port, done); | ||
}); | ||
afterEach(function(done) { | ||
this.httpServer.close(done); | ||
}); | ||
it('should correctly respond to a missing request', function(done) { | ||
catchErrors(done, () => { | ||
request('http://localhost:' + this.port + '/notUrl', | ||
(err, res, body) => { | ||
expect(err).toBeFalsy(); | ||
expect(res).not.toBe(undefined); | ||
expect(res.headers['content-type']).toEqual("text/plain"); | ||
expect(res.statusCode).toEqual(404); | ||
expect(body).toEqual("No Matching Response!\n"); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
144145
1
1480
17
- Removedcoveralls@^3.0.0
- Removedajv@6.12.6(transitive)
- Removedargparse@1.0.10(transitive)
- Removedasn1@0.2.6(transitive)
- Removedassert-plus@1.0.0(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedaws-sign2@0.7.0(transitive)
- Removedaws4@1.13.2(transitive)
- Removedbcrypt-pbkdf@1.0.2(transitive)
- Removedcaseless@0.12.0(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedcore-util-is@1.0.2(transitive)
- Removedcoveralls@3.1.1(transitive)
- Removeddashdash@1.14.1(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removedecc-jsbn@0.1.2(transitive)
- Removedesprima@4.0.1(transitive)
- Removedextend@3.0.2(transitive)
- Removedextsprintf@1.3.0(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedforever-agent@0.6.1(transitive)
- Removedform-data@2.3.3(transitive)
- Removedgetpass@0.1.7(transitive)
- Removedhar-schema@2.0.0(transitive)
- Removedhar-validator@5.1.5(transitive)
- Removedhttp-signature@1.2.0(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedisstream@0.1.2(transitive)
- Removedjs-yaml@3.14.1(transitive)
- Removedjsbn@0.1.1(transitive)
- Removedjson-schema@0.4.0(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
- Removedjson-stringify-safe@5.0.1(transitive)
- Removedjsprim@1.4.2(transitive)
- Removedlcov-parse@1.0.0(transitive)
- Removedlog-driver@1.2.7(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedminimist@1.2.8(transitive)
- Removedoauth-sign@0.9.0(transitive)
- Removedperformance-now@2.1.0(transitive)
- Removedpsl@1.15.0(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedqs@6.5.3(transitive)
- Removedrequest@2.88.2(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsprintf-js@1.0.3(transitive)
- Removedsshpk@1.18.0(transitive)
- Removedtough-cookie@2.5.0(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removedtweetnacl@0.14.5(transitive)
- Removeduri-js@4.4.1(transitive)
- Removeduuid@3.4.0(transitive)
- Removedverror@1.10.0(transitive)