[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,6 +186,7 @@ class {{classname}}:
{{#hasProduces}} {{#hasProduces}}
# set the HTTP header `Accept` # set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept( _header_params['Accept'] = self.api_client.select_header_accept(
[{{#produces}} [{{#produces}}
'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/produces}} '{{{mediaType}}}'{{^-last}}, {{/-last}}{{/produces}}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -266,6 +266,7 @@ class AnotherFakeApi:
# set the HTTP header `Accept` # set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept( _header_params['Accept'] = self.api_client.select_header_accept(
[ [
'application/json' 'application/json'

View File

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

View File

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

View File

@ -266,6 +266,7 @@ class FakeClassnameTags123Api:
# set the HTTP header `Accept` # set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept( _header_params['Accept'] = self.api_client.select_header_accept(
[ [
'application/json' 'application/json'

View File

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

View File

@ -814,6 +814,7 @@ class PetApi:
# set the HTTP header `Accept` # set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept( _header_params['Accept'] = self.api_client.select_header_accept(
[ [
'application/xml', 'application/xml',
@ -1083,6 +1084,7 @@ class PetApi:
# set the HTTP header `Accept` # set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept( _header_params['Accept'] = self.api_client.select_header_accept(
[ [
'application/xml', 'application/xml',
@ -1349,6 +1351,7 @@ class PetApi:
# set the HTTP header `Accept` # set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept( _header_params['Accept'] = self.api_client.select_header_accept(
[ [
'application/xml', 'application/xml',
@ -2212,6 +2215,7 @@ class PetApi:
# set the HTTP header `Accept` # set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept( _header_params['Accept'] = self.api_client.select_header_accept(
[ [
'application/json' 'application/json'
@ -2513,6 +2517,7 @@ class PetApi:
# set the HTTP header `Accept` # set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept( _header_params['Accept'] = self.api_client.select_header_accept(
[ [
'application/json' 'application/json'

View File

@ -506,6 +506,7 @@ class StoreApi:
# set the HTTP header `Accept` # set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept( _header_params['Accept'] = self.api_client.select_header_accept(
[ [
'application/json' 'application/json'
@ -770,6 +771,7 @@ class StoreApi:
# set the HTTP header `Accept` # set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept( _header_params['Accept'] = self.api_client.select_header_accept(
[ [
'application/xml', 'application/xml',
@ -1031,6 +1033,7 @@ class StoreApi:
# set the HTTP header `Accept` # set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept( _header_params['Accept'] = self.api_client.select_header_accept(
[ [
'application/xml', 'application/xml',

View File

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

View File

@ -58,6 +58,26 @@ class TestPetApiTests(unittest.TestCase):
self.test_file_dir = os.path.realpath(self.test_file_dir) self.test_file_dir = os.path.realpath(self.test_file_dir)
self.foo = os.path.join(self.test_file_dir, "foo.png") 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): def test_separate_default_client_instances(self):
pet_api = petstore_api.PetApi() pet_api = petstore_api.PetApi()
pet_api2 = petstore_api.PetApi() pet_api2 = petstore_api.PetApi()

View File

@ -266,6 +266,7 @@ class AnotherFakeApi:
# set the HTTP header `Accept` # set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept( _header_params['Accept'] = self.api_client.select_header_accept(
[ [
'application/json' 'application/json'

View File

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

View File

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

View File

@ -266,6 +266,7 @@ class FakeClassnameTags123Api:
# set the HTTP header `Accept` # set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept( _header_params['Accept'] = self.api_client.select_header_accept(
[ [
'application/json' 'application/json'

View File

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

View File

@ -814,6 +814,7 @@ class PetApi:
# set the HTTP header `Accept` # set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept( _header_params['Accept'] = self.api_client.select_header_accept(
[ [
'application/xml', 'application/xml',
@ -1083,6 +1084,7 @@ class PetApi:
# set the HTTP header `Accept` # set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept( _header_params['Accept'] = self.api_client.select_header_accept(
[ [
'application/xml', 'application/xml',
@ -1349,6 +1351,7 @@ class PetApi:
# set the HTTP header `Accept` # set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept( _header_params['Accept'] = self.api_client.select_header_accept(
[ [
'application/xml', 'application/xml',
@ -2212,6 +2215,7 @@ class PetApi:
# set the HTTP header `Accept` # set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept( _header_params['Accept'] = self.api_client.select_header_accept(
[ [
'application/json' 'application/json'
@ -2513,6 +2517,7 @@ class PetApi:
# set the HTTP header `Accept` # set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept( _header_params['Accept'] = self.api_client.select_header_accept(
[ [
'application/json' 'application/json'

View File

@ -506,6 +506,7 @@ class StoreApi:
# set the HTTP header `Accept` # set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept( _header_params['Accept'] = self.api_client.select_header_accept(
[ [
'application/json' 'application/json'
@ -770,6 +771,7 @@ class StoreApi:
# set the HTTP header `Accept` # set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept( _header_params['Accept'] = self.api_client.select_header_accept(
[ [
'application/xml', 'application/xml',
@ -1031,6 +1033,7 @@ class StoreApi:
# set the HTTP header `Accept` # set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept( _header_params['Accept'] = self.api_client.select_header_accept(
[ [
'application/xml', 'application/xml',

View File

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

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=5.0)
self.pet_api.add_pet(self.pet, _request_timeout=(1.0, 2.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): def test_separate_default_config_instances(self):
# ensure the default api client is used # ensure the default api client is used
pet_api = petstore_api.PetApi() pet_api = petstore_api.PetApi()