UNPKG

unmock-core

Version:

[![npm](https://img.shields.io/npm/v/unmock-core.svg)][npmjs] [![CircleCI](https://circleci.com/gh/unmock/unmock-js.svg?style=svg)](https://circleci.com/gh/unmock/unmock-js) [![codecov](https://codecov.io/gh/unmock/unmock-js/branch/dev/graph/badge.svg)](h

19 lines 686 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class JSONDeserializer { deserialize(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 === "object" ? { body: JSON.stringify(json.body) } : {})); } return json; } } exports.default = JSONDeserializer; //# sourceMappingURL=json.js.map