@@ -219,2 +219,20 @@ var http = require('http'), | ||
/** | ||
* Hock.copy | ||
* | ||
* @description enqueue a COPY request into the assertion queue | ||
* | ||
* @param {String} url the route of the request to match | ||
* @param {object|String} [body] the request body (if any) of the request to match | ||
* @param {object} [headers] optionally match the request headers | ||
* @returns {Request} | ||
*/ | ||
Hock.prototype.copy = function (url, body, headers) { | ||
return new Request(this, { | ||
method: 'COPY', | ||
url: url, | ||
headers: headers || {} | ||
}); | ||
}; | ||
/** | ||
* Hock.filteringRequestBody | ||
@@ -221,0 +239,0 @@ * |
{ | ||
"name": "hock", | ||
"description": "A mocking server for HTTP requests", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"author": "Maciej MaĆecki <me@mmalecki.com>", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
@@ -41,2 +41,3 @@ # hock [](http://travis-ci.org/mmalecki/hock) | ||
* HEAD | ||
* COPY | ||
@@ -43,0 +44,0 @@ ```Javascript |
@@ -136,2 +136,19 @@ var http = require('http'), | ||
it('should correctly respond to an HTTP COPY request', function(done) { | ||
hockInstance | ||
.copy('/copysrc') | ||
.reply(204); | ||
request({ | ||
uri: 'http://localhost:' + PORT + '/copysrc', | ||
method: 'COPY' | ||
}, function(err, res, body) { | ||
should.not.exist(err); | ||
should.exist(res); | ||
res.statusCode.should.equal(204); | ||
body.should.equal(''); | ||
done(); | ||
}); | ||
}); | ||
it('unmatched requests should throw', function () { | ||
@@ -138,0 +155,0 @@ hockInstance |
43862
2.22%1185
2.78%233
0.43%