@kaluza/mock-server
Advanced tools
Comparing version 0.5.0 to 0.6.0
@@ -59,2 +59,3 @@ "use strict"; | ||
Method["POST"] = "POST"; | ||
Method["PATCH"] = "PATCH"; | ||
})(Method || (Method = {})); | ||
@@ -74,2 +75,5 @@ var MockServer = /** @class */ (function () { | ||
}; | ||
MockServer.prototype.patch = function (path, response) { | ||
return this.createEndpoint(Method.PATCH, path, response); | ||
}; | ||
MockServer.prototype.start = function () { | ||
@@ -142,2 +146,5 @@ return __awaiter(this, void 0, void 0, function () { | ||
break; | ||
case Method.PATCH: | ||
_this.router.patch(path, middleware_1.recordCalls(endpoint.record.calls), endpoint.handler); | ||
break; | ||
} | ||
@@ -144,0 +151,0 @@ }); |
{ | ||
"name": "@kaluza/mock-server", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"main": "dist/mockserver.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -59,2 +59,10 @@ # Node Mock Server | ||
#### server.patch(path, response) | ||
Registers a PATCH endpoint for the given path, returning an `EndpointRecord`. | ||
* `path` is an [Express-compatible path](https://expressjs.com/en/4x/api.html#path-examples) | ||
* `response` can be either an object, which will be returned as JSON, or an Express-compatible request handler. This lets you vary the response based on what's in the request. | ||
If two endpoints are created on the same path, the most recently created one will take precedence. | ||
#### server.reset() | ||
@@ -61,0 +69,0 @@ |
12403
174
82