From 567eb6cdd3255cecb5683ffcd30331468966bc71 Mon Sep 17 00:00:00 2001 From: Sebastien Arod Date: Fri, 26 Apr 2019 19:45:34 +0200 Subject: [PATCH] [Bug][Python]Support body as bytes when Content-Type is unknown (#2626) * Support body as bytes when Content-Type is unknownfix #2623 * Revert unwanted import changes * update samples/openapi3 --- .../openapi-generator/src/main/resources/python/rest.mustache | 2 +- samples/client/petstore/python/petstore_api/rest.py | 2 +- samples/openapi3/client/petstore/python/petstore_api/rest.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/python/rest.mustache b/modules/openapi-generator/src/main/resources/python/rest.mustache index 98f2c502a91d..772efe91b39f 100644 --- a/modules/openapi-generator/src/main/resources/python/rest.mustache +++ b/modules/openapi-generator/src/main/resources/python/rest.mustache @@ -181,7 +181,7 @@ class RESTClientObject(object): # Pass a `string` parameter directly in the body to support # other content types than Json when `body` argument is # provided in serialized form - elif isinstance(body, str): + elif isinstance(body, str) or isinstance(body, bytes): request_body = body r = self.pool_manager.request( method, url, diff --git a/samples/client/petstore/python/petstore_api/rest.py b/samples/client/petstore/python/petstore_api/rest.py index e1e032711e74..6ce51c7c316d 100644 --- a/samples/client/petstore/python/petstore_api/rest.py +++ b/samples/client/petstore/python/petstore_api/rest.py @@ -189,7 +189,7 @@ class RESTClientObject(object): # Pass a `string` parameter directly in the body to support # other content types than Json when `body` argument is # provided in serialized form - elif isinstance(body, str): + elif isinstance(body, str) or isinstance(body, bytes): request_body = body r = self.pool_manager.request( method, url, diff --git a/samples/openapi3/client/petstore/python/petstore_api/rest.py b/samples/openapi3/client/petstore/python/petstore_api/rest.py index e1e032711e74..6ce51c7c316d 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/rest.py +++ b/samples/openapi3/client/petstore/python/petstore_api/rest.py @@ -189,7 +189,7 @@ class RESTClientObject(object): # Pass a `string` parameter directly in the body to support # other content types than Json when `body` argument is # provided in serialized form - elif isinstance(body, str): + elif isinstance(body, str) or isinstance(body, bytes): request_body = body r = self.pool_manager.request( method, url,