unmock-core
Version:
[][npmjs] [](https://circleci.com/gh/unmock/unmock-js) [](h
19 lines • 676 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
class JSONSerializer {
serialize(json) {
const contentType = json.headers
? json.headers["Content-Type"] || json.headers["content-type"]
: undefined;
if (contentType &&
typeof contentType === "string" &&
contentType.startsWith("application/json")) {
return Object.assign(Object.assign({}, json), (json.body && typeof json.body === "string"
? { body: JSON.parse(json.body) }
: {}));
}
return json;
}
}
exports.default = JSONSerializer;
//# sourceMappingURL=json.js.map