[Python] Allow Overriding Accept Header (#19025)

* [Python] Allow Overriding Accept Header

* generate samples

* add tests
This commit is contained in:
Cameron Koegel 2024-06-28 07:27:10 -04:00 committed by GitHub
parent 44e9ff58bd
commit 53f1094765
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
31 changed files with 779 additions and 619 deletions

View File

@ -186,11 +186,12 @@ class {{classname}}:
{{#hasProduces}}
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[{{#produces}}
'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/produces}}
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[{{#produces}}
'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/produces}}
]
)
{{/hasProduces}}
{{#hasConsumes}}

View File

@ -250,11 +250,12 @@ class AuthApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# authentication setting
@ -493,11 +494,12 @@ class AuthApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# authentication setting

View File

@ -255,11 +255,12 @@ class BodyApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'image/gif'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'image/gif'
]
)
# authentication setting
@ -517,11 +518,12 @@ class BodyApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@ -788,11 +790,12 @@ class BodyApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@ -1058,11 +1061,12 @@ class BodyApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@ -1328,11 +1332,12 @@ class BodyApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@ -1598,11 +1603,12 @@ class BodyApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@ -1868,11 +1874,12 @@ class BodyApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@ -2138,11 +2145,12 @@ class BodyApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@ -2408,11 +2416,12 @@ class BodyApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@ -2678,11 +2687,12 @@ class BodyApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# set the HTTP header `Content-Type`
if _content_type:

View File

@ -297,11 +297,12 @@ class FormApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@ -567,11 +568,12 @@ class FormApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@ -912,11 +914,12 @@ class FormApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# set the HTTP header `Content-Type`
if _content_type:

View File

@ -327,11 +327,12 @@ class HeaderApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# authentication setting

View File

@ -311,11 +311,12 @@ class PathApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# authentication setting

View File

@ -289,11 +289,12 @@ class QueryApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# authentication setting
@ -600,11 +601,12 @@ class QueryApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# authentication setting
@ -893,11 +895,12 @@ class QueryApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# authentication setting
@ -1152,11 +1155,12 @@ class QueryApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# authentication setting
@ -1411,11 +1415,12 @@ class QueryApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# authentication setting
@ -1671,11 +1676,12 @@ class QueryApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# authentication setting
@ -1931,11 +1937,12 @@ class QueryApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# authentication setting
@ -2190,11 +2197,12 @@ class QueryApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# authentication setting
@ -2449,11 +2457,12 @@ class QueryApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# authentication setting
@ -2708,11 +2717,12 @@ class QueryApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# authentication setting

View File

@ -250,11 +250,12 @@ class AuthApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# authentication setting
@ -493,11 +494,12 @@ class AuthApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# authentication setting

View File

@ -255,11 +255,12 @@ class BodyApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'image/gif'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'image/gif'
]
)
# authentication setting
@ -517,11 +518,12 @@ class BodyApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@ -788,11 +790,12 @@ class BodyApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@ -1058,11 +1061,12 @@ class BodyApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@ -1328,11 +1332,12 @@ class BodyApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@ -1598,11 +1603,12 @@ class BodyApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@ -1868,11 +1874,12 @@ class BodyApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@ -2138,11 +2145,12 @@ class BodyApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@ -2408,11 +2416,12 @@ class BodyApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@ -2678,11 +2687,12 @@ class BodyApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# set the HTTP header `Content-Type`
if _content_type:

View File

@ -297,11 +297,12 @@ class FormApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@ -567,11 +568,12 @@ class FormApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@ -912,11 +914,12 @@ class FormApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# set the HTTP header `Content-Type`
if _content_type:

View File

@ -327,11 +327,12 @@ class HeaderApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# authentication setting

View File

@ -311,11 +311,12 @@ class PathApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# authentication setting

View File

@ -289,11 +289,12 @@ class QueryApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# authentication setting
@ -600,11 +601,12 @@ class QueryApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# authentication setting
@ -893,11 +895,12 @@ class QueryApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# authentication setting
@ -1152,11 +1155,12 @@ class QueryApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# authentication setting
@ -1411,11 +1415,12 @@ class QueryApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# authentication setting
@ -1671,11 +1676,12 @@ class QueryApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# authentication setting
@ -1931,11 +1937,12 @@ class QueryApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# authentication setting
@ -2190,11 +2197,12 @@ class QueryApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# authentication setting
@ -2449,11 +2457,12 @@ class QueryApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# authentication setting
@ -2708,11 +2717,12 @@ class QueryApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# authentication setting

View File

@ -266,11 +266,12 @@ class AnotherFakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# set the HTTP header `Content-Type`
if _content_type:

View File

@ -243,11 +243,12 @@ class DefaultApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting

View File

@ -772,11 +772,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting
@ -1324,11 +1325,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'*/*'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'*/*'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@ -1594,11 +1596,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'*/*'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'*/*'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@ -1864,11 +1867,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'*/*'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'*/*'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@ -2134,11 +2138,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'*/*'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'*/*'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@ -2422,11 +2427,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'*/*'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'*/*'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@ -2674,11 +2680,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'plain/text'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'plain/text'
]
)
# authentication setting
@ -2913,11 +2920,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting
@ -3152,11 +3160,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'plain/text'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'plain/text'
]
)
# authentication setting
@ -3391,11 +3400,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting
@ -3630,11 +3640,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'plain/text'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'plain/text'
]
)
# authentication setting
@ -3869,11 +3880,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting
@ -4108,11 +4120,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting
@ -4347,11 +4360,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting
@ -4586,11 +4600,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'plain/text'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'plain/text'
]
)
# authentication setting
@ -4825,11 +4840,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting
@ -6407,11 +6423,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@ -6941,11 +6958,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# authentication setting
@ -7664,11 +7682,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting

View File

@ -266,11 +266,12 @@ class FakeClassnameTags123Api:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# set the HTTP header `Content-Type`
if _content_type:

View File

@ -246,11 +246,12 @@ class ImportTestDatetimeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting

View File

@ -814,12 +814,13 @@ class PetApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/xml',
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/xml',
'application/json'
]
)
# authentication setting
@ -1083,12 +1084,13 @@ class PetApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/xml',
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/xml',
'application/json'
]
)
# authentication setting
@ -1349,12 +1351,13 @@ class PetApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/xml',
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/xml',
'application/json'
]
)
# authentication setting
@ -2212,11 +2215,12 @@ class PetApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@ -2513,11 +2517,12 @@ class PetApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# set the HTTP header `Content-Type`
if _content_type:

View File

@ -506,11 +506,12 @@ class StoreApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting
@ -770,12 +771,13 @@ class StoreApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/xml',
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/xml',
'application/json'
]
)
# authentication setting
@ -1031,12 +1033,13 @@ class StoreApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/xml',
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/xml',
'application/json'
]
)
# set the HTTP header `Content-Type`
if _content_type:

View File

@ -1317,12 +1317,13 @@ class UserApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/xml',
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/xml',
'application/json'
]
)
# authentication setting
@ -1597,12 +1598,13 @@ class UserApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/xml',
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/xml',
'application/json'
]
)
# authentication setting

View File

@ -58,6 +58,26 @@ class TestPetApiTests(unittest.TestCase):
self.test_file_dir = os.path.realpath(self.test_file_dir)
self.foo = os.path.join(self.test_file_dir, "foo.png")
def test_accept_header_serialization(self):
(_, _, headers, *_) = self.pet_api._get_pet_by_id_serialize(
pet_id=self.pet.id,
_request_auth=None,
_content_type=None,
_headers=None,
_host_index=0
)
self.assertEqual(headers['Accept'], 'application/json')
(_, _, headers_overwritten, *_) = self.pet_api._get_pet_by_id_serialize(
pet_id=self.pet.id,
_request_auth=None,
_content_type=None,
_headers={'Accept': 'text/plain'},
_host_index=0
)
self.assertEqual(headers_overwritten['Accept'], 'text/plain')
def test_separate_default_client_instances(self):
pet_api = petstore_api.PetApi()
pet_api2 = petstore_api.PetApi()

View File

@ -266,11 +266,12 @@ class AnotherFakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# set the HTTP header `Content-Type`
if _content_type:

View File

@ -243,11 +243,12 @@ class DefaultApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting

View File

@ -772,11 +772,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting
@ -1324,11 +1325,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'*/*'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'*/*'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@ -1594,11 +1596,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'*/*'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'*/*'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@ -1864,11 +1867,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'*/*'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'*/*'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@ -2134,11 +2138,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'*/*'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'*/*'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@ -2422,11 +2427,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'*/*'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'*/*'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@ -2674,11 +2680,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'plain/text'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'plain/text'
]
)
# authentication setting
@ -2913,11 +2920,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting
@ -3152,11 +3160,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'plain/text'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'plain/text'
]
)
# authentication setting
@ -3391,11 +3400,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting
@ -3630,11 +3640,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'plain/text'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'plain/text'
]
)
# authentication setting
@ -3869,11 +3880,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting
@ -4108,11 +4120,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting
@ -4347,11 +4360,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting
@ -4586,11 +4600,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'plain/text'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'plain/text'
]
)
# authentication setting
@ -4825,11 +4840,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting
@ -6407,11 +6423,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@ -6941,11 +6958,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# authentication setting
@ -7664,11 +7682,12 @@ class FakeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting

View File

@ -266,11 +266,12 @@ class FakeClassnameTags123Api:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# set the HTTP header `Content-Type`
if _content_type:

View File

@ -246,11 +246,12 @@ class ImportTestDatetimeApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting

View File

@ -814,12 +814,13 @@ class PetApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/xml',
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/xml',
'application/json'
]
)
# authentication setting
@ -1083,12 +1084,13 @@ class PetApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/xml',
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/xml',
'application/json'
]
)
# authentication setting
@ -1349,12 +1351,13 @@ class PetApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/xml',
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/xml',
'application/json'
]
)
# authentication setting
@ -2212,11 +2215,12 @@ class PetApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# set the HTTP header `Content-Type`
if _content_type:
@ -2513,11 +2517,12 @@ class PetApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# set the HTTP header `Content-Type`
if _content_type:

View File

@ -506,11 +506,12 @@ class StoreApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting
@ -770,12 +771,13 @@ class StoreApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/xml',
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/xml',
'application/json'
]
)
# authentication setting
@ -1031,12 +1033,13 @@ class StoreApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/xml',
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/xml',
'application/json'
]
)
# set the HTTP header `Content-Type`
if _content_type:

View File

@ -1317,12 +1317,13 @@ class UserApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/xml',
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/xml',
'application/json'
]
)
# authentication setting
@ -1597,12 +1598,13 @@ class UserApi:
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/xml',
'application/json'
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/xml',
'application/json'
]
)
# authentication setting

View File

@ -107,6 +107,25 @@ class PetApiTests(unittest.TestCase):
self.pet_api.add_pet(self.pet, _request_timeout=5.0)
self.pet_api.add_pet(self.pet, _request_timeout=(1.0, 2.0))
def test_accept_header_serialization(self):
(_, _, headers, *_) = self.pet_api._get_pet_by_id_serialize(
pet_id=self.pet.id,
_request_auth=None,
_content_type=None,
_headers=None,
_host_index=0
)
self.assertEqual(headers['Accept'], 'application/json')
(_, _, headers_overwritten, *_) = self.pet_api._get_pet_by_id_serialize(
pet_id=self.pet.id,
_request_auth=None,
_content_type=None,
_headers={'Accept': 'text/plain'},
_host_index=0
)
self.assertEqual(headers_overwritten['Accept'], 'text/plain')
def test_separate_default_config_instances(self):
# ensure the default api client is used
pet_api = petstore_api.PetApi()