File tree Expand file tree Collapse file tree
modules/openapi-generator/src/main/resources/python
python-disallowAdditionalPropertiesIfNotPresent/openapi_client
python-aiohttp/petstore_api
python-httpx-sync/petstore_api
python-httpx/petstore_api
python-lazyImports/petstore_api Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -680,7 +680,16 @@ class ApiClient:
680680 :param auth_setting: auth settings for the endpoint
681681 """
682682 if auth_setting['in'] == 'cookie':
683- headers['Cookie'] = auth_setting['value']
683+ if not 'Cookie' in headers:
684+ headers['Cookie'] = ""
685+ else:
686+ headers['Cookie'] += "; "
687+ # Account for cookie value containing spaces and special characters
688+ cookie_value = str(auth_setting['value'])
689+ if not re.match("^\".*\"$", cookie_value):
690+ cookie_value = cookie_value.replace("\"", "\\\"")
691+ cookie_value = f"\"{ cookie_value} \""
692+ headers['Cookie'] += f"{ auth_setting[' key' ]} ={ cookie_value} "
684693 elif auth_setting['in'] == 'header':
685694 if auth_setting['type'] != 'http-signature':
686695 headers[auth_setting['key']] = auth_setting['value']
Original file line number Diff line number Diff line change @@ -673,7 +673,16 @@ def _apply_auth_params(
673673 :param auth_setting: auth settings for the endpoint
674674 """
675675 if auth_setting ['in' ] == 'cookie' :
676- headers ['Cookie' ] = auth_setting ['value' ]
676+ if not 'Cookie' in headers :
677+ headers ['Cookie' ] = ""
678+ else :
679+ headers ['Cookie' ] += "; "
680+ # Account for cookie value containing spaces and special characters
681+ cookie_value = str (auth_setting ['value' ])
682+ if not re .match ("^\" .*\" $" , cookie_value ):
683+ cookie_value = cookie_value .replace ("\" " , "\\ \" " )
684+ cookie_value = f"\" { cookie_value } \" "
685+ headers ['Cookie' ] += f"{ auth_setting ['key' ]} ={ cookie_value } "
677686 elif auth_setting ['in' ] == 'header' :
678687 if auth_setting ['type' ] != 'http-signature' :
679688 headers [auth_setting ['key' ]] = auth_setting ['value' ]
Original file line number Diff line number Diff line change @@ -673,7 +673,16 @@ def _apply_auth_params(
673673 :param auth_setting: auth settings for the endpoint
674674 """
675675 if auth_setting ['in' ] == 'cookie' :
676- headers ['Cookie' ] = auth_setting ['value' ]
676+ if not 'Cookie' in headers :
677+ headers ['Cookie' ] = ""
678+ else :
679+ headers ['Cookie' ] += "; "
680+ # Account for cookie value containing spaces and special characters
681+ cookie_value = str (auth_setting ['value' ])
682+ if not re .match ("^\" .*\" $" , cookie_value ):
683+ cookie_value = cookie_value .replace ("\" " , "\\ \" " )
684+ cookie_value = f"\" { cookie_value } \" "
685+ headers ['Cookie' ] += f"{ auth_setting ['key' ]} ={ cookie_value } "
677686 elif auth_setting ['in' ] == 'header' :
678687 if auth_setting ['type' ] != 'http-signature' :
679688 headers [auth_setting ['key' ]] = auth_setting ['value' ]
Original file line number Diff line number Diff line change @@ -675,7 +675,16 @@ def _apply_auth_params(
675675 :param auth_setting: auth settings for the endpoint
676676 """
677677 if auth_setting ['in' ] == 'cookie' :
678- headers ['Cookie' ] = auth_setting ['value' ]
678+ if not 'Cookie' in headers :
679+ headers ['Cookie' ] = ""
680+ else :
681+ headers ['Cookie' ] += "; "
682+ # Account for cookie value containing spaces and special characters
683+ cookie_value = str (auth_setting ['value' ])
684+ if not re .match ("^\" .*\" $" , cookie_value ):
685+ cookie_value = cookie_value .replace ("\" " , "\\ \" " )
686+ cookie_value = f"\" { cookie_value } \" "
687+ headers ['Cookie' ] += f"{ auth_setting ['key' ]} ={ cookie_value } "
679688 elif auth_setting ['in' ] == 'header' :
680689 if auth_setting ['type' ] != 'http-signature' :
681690 headers [auth_setting ['key' ]] = auth_setting ['value' ]
Original file line number Diff line number Diff line change @@ -675,7 +675,16 @@ def _apply_auth_params(
675675 :param auth_setting: auth settings for the endpoint
676676 """
677677 if auth_setting ['in' ] == 'cookie' :
678- headers ['Cookie' ] = auth_setting ['value' ]
678+ if not 'Cookie' in headers :
679+ headers ['Cookie' ] = ""
680+ else :
681+ headers ['Cookie' ] += "; "
682+ # Account for cookie value containing spaces and special characters
683+ cookie_value = str (auth_setting ['value' ])
684+ if not re .match ("^\" .*\" $" , cookie_value ):
685+ cookie_value = cookie_value .replace ("\" " , "\\ \" " )
686+ cookie_value = f"\" { cookie_value } \" "
687+ headers ['Cookie' ] += f"{ auth_setting ['key' ]} ={ cookie_value } "
679688 elif auth_setting ['in' ] == 'header' :
680689 if auth_setting ['type' ] != 'http-signature' :
681690 headers [auth_setting ['key' ]] = auth_setting ['value' ]
Original file line number Diff line number Diff line change @@ -675,7 +675,16 @@ def _apply_auth_params(
675675 :param auth_setting: auth settings for the endpoint
676676 """
677677 if auth_setting ['in' ] == 'cookie' :
678- headers ['Cookie' ] = auth_setting ['value' ]
678+ if not 'Cookie' in headers :
679+ headers ['Cookie' ] = ""
680+ else :
681+ headers ['Cookie' ] += "; "
682+ # Account for cookie value containing spaces and special characters
683+ cookie_value = str (auth_setting ['value' ])
684+ if not re .match ("^\" .*\" $" , cookie_value ):
685+ cookie_value = cookie_value .replace ("\" " , "\\ \" " )
686+ cookie_value = f"\" { cookie_value } \" "
687+ headers ['Cookie' ] += f"{ auth_setting ['key' ]} ={ cookie_value } "
679688 elif auth_setting ['in' ] == 'header' :
680689 if auth_setting ['type' ] != 'http-signature' :
681690 headers [auth_setting ['key' ]] = auth_setting ['value' ]
Original file line number Diff line number Diff line change @@ -672,7 +672,16 @@ def _apply_auth_params(
672672 :param auth_setting: auth settings for the endpoint
673673 """
674674 if auth_setting ['in' ] == 'cookie' :
675- headers ['Cookie' ] = auth_setting ['value' ]
675+ if not 'Cookie' in headers :
676+ headers ['Cookie' ] = ""
677+ else :
678+ headers ['Cookie' ] += "; "
679+ # Account for cookie value containing spaces and special characters
680+ cookie_value = str (auth_setting ['value' ])
681+ if not re .match ("^\" .*\" $" , cookie_value ):
682+ cookie_value = cookie_value .replace ("\" " , "\\ \" " )
683+ cookie_value = f"\" { cookie_value } \" "
684+ headers ['Cookie' ] += f"{ auth_setting ['key' ]} ={ cookie_value } "
676685 elif auth_setting ['in' ] == 'header' :
677686 if auth_setting ['type' ] != 'http-signature' :
678687 headers [auth_setting ['key' ]] = auth_setting ['value' ]
Original file line number Diff line number Diff line change @@ -672,7 +672,16 @@ def _apply_auth_params(
672672 :param auth_setting: auth settings for the endpoint
673673 """
674674 if auth_setting ['in' ] == 'cookie' :
675- headers ['Cookie' ] = auth_setting ['value' ]
675+ if not 'Cookie' in headers :
676+ headers ['Cookie' ] = ""
677+ else :
678+ headers ['Cookie' ] += "; "
679+ # Account for cookie value containing spaces and special characters
680+ cookie_value = str (auth_setting ['value' ])
681+ if not re .match ("^\" .*\" $" , cookie_value ):
682+ cookie_value = cookie_value .replace ("\" " , "\\ \" " )
683+ cookie_value = f"\" { cookie_value } \" "
684+ headers ['Cookie' ] += f"{ auth_setting ['key' ]} ={ cookie_value } "
676685 elif auth_setting ['in' ] == 'header' :
677686 if auth_setting ['type' ] != 'http-signature' :
678687 headers [auth_setting ['key' ]] = auth_setting ['value' ]
You can’t perform that action at this time.
0 commit comments