From 2dedf06ec68b838cfb1be1738ed02e73dbca607d Mon Sep 17 00:00:00 2001 From: Dmitry Ostrikov Date: Tue, 19 Sep 2023 08:43:53 +0300 Subject: [PATCH] fix(oas): adjust according to code review closes #210 --- .../converter/parts/Oas2MediaTypesResolver.ts | 26 +- .../parts/headers/HeadersConverter.ts | 7 +- .../parts/headers/Oas2HeadersConveter.ts | 2 +- .../parts/postdata/Oas2BodyConverter.ts | 2 +- .../fixtures/binary-body.swagger.result.json | 16 + .../tests/fixtures/github.swagger.result.json | 584 ------------------ .../missing-consumes.swagger.result.json | 4 + .../missing-security.swagger.result.json | 4 - .../override-consumes.swagger.result.json | 4 + .../params-header.swagger.result.json | 4 +- .../fixtures/params-path.swagger.result.json | 20 +- .../fixtures/params-query.swagger.result.json | 28 +- .../scheme-security.swagger.result.json | 20 +- .../fixtures/xml-models.swagger.result.json | 4 + 14 files changed, 85 insertions(+), 640 deletions(-) diff --git a/packages/oas/src/converter/parts/Oas2MediaTypesResolver.ts b/packages/oas/src/converter/parts/Oas2MediaTypesResolver.ts index 5206a40d..bca5af41 100644 --- a/packages/oas/src/converter/parts/Oas2MediaTypesResolver.ts +++ b/packages/oas/src/converter/parts/Oas2MediaTypesResolver.ts @@ -1,30 +1,26 @@ import { isOASV2 } from '../../utils'; - import { OpenAPIV2 } from '@har-sdk/core'; export class Oas2MediaTypesResolver { - private readonly DEFAULT_MEDIA_TYPE = 'application/json'; + private readonly DEFAULT_CONSUME_MEDIA_TYPE: OpenAPIV2.MimeTypes = [ + 'application/json' + ]; + private readonly DEFAULT_PRODUCE_MEDIA_TYPE: OpenAPIV2.MimeTypes = ['*/*']; constructor(private readonly spec: OpenAPIV2.Document) {} public resolveToConsume(operation: OpenAPIV2.OperationObject) { - let mediaTypes = this.resolve(operation, 'consumes'); - if (!mediaTypes?.length) { - mediaTypes = [this.DEFAULT_MEDIA_TYPE]; - } - - return mediaTypes; + return this.resolve(operation, 'consumes', this.DEFAULT_CONSUME_MEDIA_TYPE); } public resolveToProduce(operation: OpenAPIV2.OperationObject) { - const mediaTypes = this.resolve(operation, 'produces'); - - return mediaTypes?.length ? mediaTypes : undefined; + return this.resolve(operation, 'produces', this.DEFAULT_PRODUCE_MEDIA_TYPE); } private resolve( operation: OpenAPIV2.OperationObject, - node: 'consumes' | 'produces' + node: 'consumes' | 'produces', + defaultMediaTypes: OpenAPIV2.MimeTypes ): OpenAPIV2.MimeTypes { let mediaTypes: OpenAPIV2.MimeTypes; @@ -34,6 +30,10 @@ export class Oas2MediaTypesResolver { mediaTypes = this.spec[node]; } - return mediaTypes?.map((mediaType) => mediaType?.trim()).filter(Boolean); + mediaTypes = mediaTypes + ?.map((mediaType) => mediaType?.trim()) + .filter(Boolean); + + return mediaTypes?.length ? mediaTypes : defaultMediaTypes; } } diff --git a/packages/oas/src/converter/parts/headers/HeadersConverter.ts b/packages/oas/src/converter/parts/headers/HeadersConverter.ts index 9f41adb1..61b4eac4 100644 --- a/packages/oas/src/converter/parts/headers/HeadersConverter.ts +++ b/packages/oas/src/converter/parts/headers/HeadersConverter.ts @@ -13,6 +13,8 @@ import jsonPointer from 'json-pointer'; export abstract class HeadersConverter implements SubConverter { + private readonly CONTENT_TYPE_METHODS = ['post', 'put', 'patch', 'delete']; + protected constructor( private readonly spec: T, private readonly sampler: Sampler @@ -32,7 +34,10 @@ export abstract class HeadersConverter const headers: Header[] = []; const pathObj = getOperation(this.spec, path, method); - headers.push(...this.createContentTypeHeaders(pathObj)); + if (this.CONTENT_TYPE_METHODS.includes(method.toLowerCase())) { + headers.push(...this.createContentTypeHeaders(pathObj)); + } + headers.push(...this.createAcceptHeaders(pathObj)); headers.push(...this.parseFromParams(path, method)); diff --git a/packages/oas/src/converter/parts/headers/Oas2HeadersConveter.ts b/packages/oas/src/converter/parts/headers/Oas2HeadersConveter.ts index d8acc9b7..423cc2ca 100644 --- a/packages/oas/src/converter/parts/headers/Oas2HeadersConveter.ts +++ b/packages/oas/src/converter/parts/headers/Oas2HeadersConveter.ts @@ -7,7 +7,7 @@ import { Header, OpenAPIV2 } from '@har-sdk/core'; export class Oas2HeadersConverter extends HeadersConverter { private readonly oas2ValueSerializer = new Oas2ValueSerializer(); - private readonly oas2MediaTypeResolver!: Oas2MediaTypesResolver; + private readonly oas2MediaTypeResolver: Oas2MediaTypesResolver; constructor(spec: OpenAPIV2.Document, sampler: Sampler) { super(spec, sampler); diff --git a/packages/oas/src/converter/parts/postdata/Oas2BodyConverter.ts b/packages/oas/src/converter/parts/postdata/Oas2BodyConverter.ts index 9980d22a..d563e159 100644 --- a/packages/oas/src/converter/parts/postdata/Oas2BodyConverter.ts +++ b/packages/oas/src/converter/parts/postdata/Oas2BodyConverter.ts @@ -5,7 +5,7 @@ import { Oas2MediaTypesResolver } from '../Oas2MediaTypesResolver'; import type { OpenAPIV2, PostData } from '@har-sdk/core'; export class Oas2BodyConverter extends BodyConverter { - private readonly oas2MediaTypeResolver!: Oas2MediaTypesResolver; + private readonly oas2MediaTypeResolver: Oas2MediaTypesResolver; constructor(spec: OpenAPIV2.Document, sampler: Sampler) { super(spec, sampler); diff --git a/packages/oas/tests/fixtures/binary-body.swagger.result.json b/packages/oas/tests/fixtures/binary-body.swagger.result.json index 11e0d17e..05663900 100644 --- a/packages/oas/tests/fixtures/binary-body.swagger.result.json +++ b/packages/oas/tests/fixtures/binary-body.swagger.result.json @@ -6,6 +6,10 @@ { "name": "content-type", "value": "image/jpeg" + }, + { + "name": "accept", + "value": "*/*" } ], "headersSize": 0, @@ -25,6 +29,10 @@ { "name": "content-type", "value": "image/png" + }, + { + "name": "accept", + "value": "*/*" } ], "headersSize": 0, @@ -44,6 +52,10 @@ { "name": "content-type", "value": "image/ico" + }, + { + "name": "accept", + "value": "*/*" } ], "headersSize": 0, @@ -63,6 +75,10 @@ { "name": "content-type", "value": "multipart/form-data" + }, + { + "name": "accept", + "value": "*/*" } ], "headersSize": 0, diff --git a/packages/oas/tests/fixtures/github.swagger.result.json b/packages/oas/tests/fixtures/github.swagger.result.json index 84d8ce37..1a69eebf 100644 --- a/packages/oas/tests/fixtures/github.swagger.result.json +++ b/packages/oas/tests/fixtures/github.swagger.result.json @@ -3,10 +3,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -46,10 +42,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -89,10 +81,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -132,10 +120,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -227,10 +211,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -275,10 +255,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -366,10 +342,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -456,10 +428,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -589,10 +557,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -765,10 +729,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -851,10 +811,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -894,10 +850,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -937,10 +889,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -1005,10 +953,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -1048,10 +992,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -1108,10 +1048,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -1151,10 +1087,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -1297,10 +1229,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -1340,10 +1268,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -1383,10 +1307,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -1486,10 +1406,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -1615,10 +1531,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -1705,10 +1617,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -1795,10 +1703,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -1838,10 +1742,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -1906,10 +1806,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -1992,10 +1888,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -2035,10 +1927,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -2121,10 +2009,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -2207,10 +2091,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -2302,10 +2182,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -2392,10 +2268,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -2478,10 +2350,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -2568,10 +2436,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -2611,10 +2475,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -2654,10 +2514,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -2697,10 +2553,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -2740,10 +2592,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -2826,10 +2674,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -2912,10 +2756,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -2998,10 +2838,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -3088,10 +2924,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -3152,10 +2984,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -3195,10 +3023,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -3238,10 +3062,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -3328,10 +3148,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -3418,10 +3234,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -3517,10 +3329,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -3565,10 +3373,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -3655,10 +3459,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -3745,10 +3545,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -3831,10 +3627,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -3874,10 +3666,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -3917,10 +3705,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -4059,10 +3843,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -4149,10 +3929,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -4192,10 +3968,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -4325,10 +4097,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -4462,10 +4230,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -4552,10 +4316,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -4600,10 +4360,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -4733,10 +4489,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -4866,10 +4618,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -4981,10 +4729,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -5080,10 +4824,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -5170,10 +4910,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -5213,10 +4949,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -5256,10 +4988,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -5346,10 +5074,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -5436,10 +5160,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -5522,10 +5242,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -5702,10 +5418,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -5835,10 +5547,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -5878,10 +5586,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -6011,10 +5715,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -6101,10 +5801,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -6191,10 +5887,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -6337,10 +6029,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -6427,10 +6115,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -6470,10 +6154,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -6573,10 +6253,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -6676,10 +6352,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -6775,10 +6447,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -6865,10 +6533,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -6955,10 +6619,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -7045,10 +6705,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -7088,10 +6744,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -7131,10 +6783,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -7221,10 +6869,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -7269,10 +6913,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -7402,10 +7042,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -7535,10 +7171,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -7625,10 +7257,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -7668,10 +7296,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -7711,10 +7335,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -7754,10 +7374,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -7797,10 +7413,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -7840,10 +7452,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -7883,10 +7491,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -7926,10 +7530,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -8016,10 +7616,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -8102,10 +7698,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -8192,10 +7784,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -8235,10 +7823,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -8278,10 +7862,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -8321,10 +7901,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -8364,10 +7940,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -8412,10 +7984,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -8468,10 +8036,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -8524,10 +8088,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -8580,10 +8140,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -8679,10 +8235,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -8769,10 +8321,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -8855,10 +8403,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -8984,10 +8528,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -9070,10 +8610,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -9199,10 +8735,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -9242,10 +8774,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -9379,10 +8907,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/vnd.github.v3" @@ -9469,10 +8993,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -9512,10 +9032,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -9598,10 +9114,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -9684,10 +9196,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -9752,10 +9260,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -9885,10 +9389,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -9928,10 +9428,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -9971,10 +9467,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -10066,10 +9558,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -10161,10 +9649,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -10247,10 +9731,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -10333,10 +9813,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -10419,10 +9895,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -10462,10 +9934,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -10510,10 +9978,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -10553,10 +10017,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -10596,10 +10056,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -10639,10 +10095,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -10682,10 +10134,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -10725,10 +10173,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -10773,10 +10217,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -10816,10 +10256,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -10859,10 +10295,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -10902,10 +10334,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -10945,10 +10373,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -10993,10 +10417,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" @@ -11036,10 +10456,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" diff --git a/packages/oas/tests/fixtures/missing-consumes.swagger.result.json b/packages/oas/tests/fixtures/missing-consumes.swagger.result.json index 21d7db39..b3863791 100644 --- a/packages/oas/tests/fixtures/missing-consumes.swagger.result.json +++ b/packages/oas/tests/fixtures/missing-consumes.swagger.result.json @@ -6,6 +6,10 @@ { "name": "content-type", "value": "application/json" + }, + { + "name": "accept", + "value": "*/*" } ], "headersSize": 0, diff --git a/packages/oas/tests/fixtures/missing-security.swagger.result.json b/packages/oas/tests/fixtures/missing-security.swagger.result.json index b0b7aafb..f0f9bbc8 100644 --- a/packages/oas/tests/fixtures/missing-security.swagger.result.json +++ b/packages/oas/tests/fixtures/missing-security.swagger.result.json @@ -3,10 +3,6 @@ "bodySize": 0, "cookies": [], "headers": [ - { - "name": "content-type", - "value": "application/json" - }, { "name": "accept", "value": "application/json" diff --git a/packages/oas/tests/fixtures/override-consumes.swagger.result.json b/packages/oas/tests/fixtures/override-consumes.swagger.result.json index 46ec5131..c05eafb5 100644 --- a/packages/oas/tests/fixtures/override-consumes.swagger.result.json +++ b/packages/oas/tests/fixtures/override-consumes.swagger.result.json @@ -6,6 +6,10 @@ { "name": "content-type", "value": "application/json" + }, + { + "name": "accept", + "value": "*/*" } ], "headersSize": 0, diff --git a/packages/oas/tests/fixtures/params-header.swagger.result.json b/packages/oas/tests/fixtures/params-header.swagger.result.json index c284e9e3..278f0a62 100644 --- a/packages/oas/tests/fixtures/params-header.swagger.result.json +++ b/packages/oas/tests/fixtures/params-header.swagger.result.json @@ -4,8 +4,8 @@ "cookies": [], "headers": [ { - "name": "content-type", - "value": "application/json" + "name": "accept", + "value": "*/*" }, { "name": "x-numeric", diff --git a/packages/oas/tests/fixtures/params-path.swagger.result.json b/packages/oas/tests/fixtures/params-path.swagger.result.json index d139ded7..73b8e3c6 100644 --- a/packages/oas/tests/fixtures/params-path.swagger.result.json +++ b/packages/oas/tests/fixtures/params-path.swagger.result.json @@ -4,8 +4,8 @@ "cookies": [], "headers": [ { - "name": "content-type", - "value": "application/json" + "name": "accept", + "value": "*/*" } ], "headersSize": 0, @@ -19,8 +19,8 @@ "cookies": [], "headers": [ { - "name": "content-type", - "value": "application/json" + "name": "accept", + "value": "*/*" } ], "headersSize": 0, @@ -34,8 +34,8 @@ "cookies": [], "headers": [ { - "name": "content-type", - "value": "application/json" + "name": "accept", + "value": "*/*" } ], "headersSize": 0, @@ -49,8 +49,8 @@ "cookies": [], "headers": [ { - "name": "content-type", - "value": "application/json" + "name": "accept", + "value": "*/*" } ], "headersSize": 0, @@ -64,8 +64,8 @@ "cookies": [], "headers": [ { - "name": "content-type", - "value": "application/json" + "name": "accept", + "value": "*/*" } ], "headersSize": 0, diff --git a/packages/oas/tests/fixtures/params-query.swagger.result.json b/packages/oas/tests/fixtures/params-query.swagger.result.json index 941cb069..cf41c1d0 100644 --- a/packages/oas/tests/fixtures/params-query.swagger.result.json +++ b/packages/oas/tests/fixtures/params-query.swagger.result.json @@ -4,8 +4,8 @@ "cookies": [], "headers": [ { - "name": "content-type", - "value": "application/json" + "name": "accept", + "value": "*/*" } ], "headersSize": 0, @@ -24,8 +24,8 @@ "cookies": [], "headers": [ { - "name": "content-type", - "value": "application/json" + "name": "accept", + "value": "*/*" } ], "headersSize": 0, @@ -44,8 +44,8 @@ "cookies": [], "headers": [ { - "name": "content-type", - "value": "application/json" + "name": "accept", + "value": "*/*" } ], "headersSize": 0, @@ -64,8 +64,8 @@ "cookies": [], "headers": [ { - "name": "content-type", - "value": "application/json" + "name": "accept", + "value": "*/*" } ], "headersSize": 0, @@ -84,8 +84,8 @@ "cookies": [], "headers": [ { - "name": "content-type", - "value": "application/json" + "name": "accept", + "value": "*/*" } ], "headersSize": 0, @@ -104,8 +104,8 @@ "cookies": [], "headers": [ { - "name": "content-type", - "value": "application/json" + "name": "accept", + "value": "*/*" } ], "headersSize": 0, @@ -128,8 +128,8 @@ "cookies": [], "headers": [ { - "name": "content-type", - "value": "application/json" + "name": "accept", + "value": "*/*" } ], "headersSize": 0, diff --git a/packages/oas/tests/fixtures/scheme-security.swagger.result.json b/packages/oas/tests/fixtures/scheme-security.swagger.result.json index 66049f3f..0183aac0 100644 --- a/packages/oas/tests/fixtures/scheme-security.swagger.result.json +++ b/packages/oas/tests/fixtures/scheme-security.swagger.result.json @@ -4,8 +4,8 @@ "cookies": [], "headers": [ { - "name": "content-type", - "value": "application/json" + "name": "accept", + "value": "*/*" } ], "headersSize": 0, @@ -19,8 +19,8 @@ "cookies": [], "headers": [ { - "name": "content-type", - "value": "application/json" + "name": "accept", + "value": "*/*" }, { "name": "authorization", @@ -42,8 +42,8 @@ "cookies": [], "headers": [ { - "name": "content-type", - "value": "application/json" + "name": "accept", + "value": "*/*" }, { "name": "x-api-key", @@ -65,8 +65,8 @@ "cookies": [], "headers": [ { - "name": "content-type", - "value": "application/json" + "name": "accept", + "value": "*/*" }, { "name": "x-api-key", @@ -84,8 +84,8 @@ "cookies": [], "headers": [ { - "name": "content-type", - "value": "application/json" + "name": "accept", + "value": "*/*" }, { "name": "x-api-key", diff --git a/packages/oas/tests/fixtures/xml-models.swagger.result.json b/packages/oas/tests/fixtures/xml-models.swagger.result.json index 9d8e99c2..d19e88ad 100644 --- a/packages/oas/tests/fixtures/xml-models.swagger.result.json +++ b/packages/oas/tests/fixtures/xml-models.swagger.result.json @@ -6,6 +6,10 @@ { "name": "content-type", "value": "application/xml" + }, + { + "name": "accept", + "value": "*/*" } ], "headersSize": 0,