wiremock-mapper
Version:
DSL for setting up WireMock mappings.
60 lines • 2.19 kB
JavaScript
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ResponseBuilderImpl = void 0;
var ResponseBuilderImpl = /** @class */ (function () {
function ResponseBuilderImpl() {
var _this = this;
this.jsonObject = {};
this.toJSON = function () { return _this.jsonObject; };
}
ResponseBuilderImpl.prototype.clone = function () {
var clone = new ResponseBuilderImpl();
clone.jsonObject = __assign({}, this.jsonObject);
return clone;
};
ResponseBuilderImpl.prototype.withBody = function (value) {
this.jsonObject.body = value;
return this;
};
ResponseBuilderImpl.prototype.withDelay = function (milliseconds) {
this.jsonObject.fixedDelayMilliseconds = milliseconds;
return this;
};
ResponseBuilderImpl.prototype.withHeader = function (key, value) {
if (this.jsonObject.headers === undefined) {
this.jsonObject.headers = {};
}
this.jsonObject.headers[key] = value;
return this;
};
ResponseBuilderImpl.prototype.withJsonBody = function (value) {
this.jsonObject.jsonBody = value;
return this;
};
ResponseBuilderImpl.prototype.withStatus = function (statusCode) {
this.jsonObject.status = statusCode;
return this;
};
ResponseBuilderImpl.prototype.withStatusMessage = function (statusMessage) {
this.jsonObject.statusMessage = statusMessage;
return this;
};
ResponseBuilderImpl.prototype.withTransformer = function (transformerName) {
this.jsonObject.transformer = transformerName;
return this;
};
return ResponseBuilderImpl;
}());
exports.ResponseBuilderImpl = ResponseBuilderImpl;
//# sourceMappingURL=response_builder.js.map