main
Last change
on this file 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 |
|
---|
3 | exports.__esModule = true;
|
---|
4 | exports.default = serialize;
|
---|
5 | /*
|
---|
6 | Serializer that serializes according to a media type instead of OpenAPI's
|
---|
7 | `style` + `explode` constructs.
|
---|
8 | */
|
---|
9 |
|
---|
10 | function 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.