source: node_modules/swagger-client/lib/execute/oas3/content-serializer.js@ 65b6638

main
Last change on this file since 65b6638 was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 447 bytes
Line 
1"use strict";
2
3exports.__esModule = true;
4exports.default = serialize;
5/*
6 Serializer that serializes according to a media type instead of OpenAPI's
7 `style` + `explode` constructs.
8*/
9
10function serialize(value, mediaType) {
11 if (mediaType.includes('application/json')) {
12 if (typeof value === 'string') {
13 // Assume the user has a JSON string
14 return value;
15 }
16 return JSON.stringify(value);
17 }
18 return value.toString();
19}
Note: See TracBrowser for help on using the repository browser.