Use percent encoding for path parameters (#2649)

This commit is contained in:
sunn 2019-04-12 05:26:48 +02:00 committed by William Cheng
parent 85d05981ec
commit 7af94fa1e8
4 changed files with 10 additions and 10 deletions

View File

@ -31,7 +31,7 @@ void
{{#pathParams}}
QString {{paramName}}PathParam("{");
{{paramName}}PathParam.append("{{baseName}}").append("}");
fullPath.replace({{paramName}}PathParam, ::{{cppNamespace}}::toStringValue({{paramName}}));
fullPath.replace({{paramName}}PathParam, QUrl::toPercentEncoding(::{{cppNamespace}}::toStringValue({{paramName}})));
{{/pathParams}}
{{#queryParams}}{{^collectionFormat}}
if (fullPath.indexOf("?") > 0)

View File

@ -85,7 +85,7 @@ OAIPetApi::deletePet(const qint64& pet_id, const QString& api_key) {
fullPath.append(this->host).append(this->basePath).append("/pet/{petId}");
QString pet_idPathParam("{");
pet_idPathParam.append("petId").append("}");
fullPath.replace(pet_idPathParam, ::OpenAPI::toStringValue(pet_id));
fullPath.replace(pet_idPathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(pet_id)));
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker();
OAIHttpRequestInput input(fullPath, "DELETE");
@ -323,7 +323,7 @@ OAIPetApi::getPetById(const qint64& pet_id) {
fullPath.append(this->host).append(this->basePath).append("/pet/{petId}");
QString pet_idPathParam("{");
pet_idPathParam.append("petId").append("}");
fullPath.replace(pet_idPathParam, ::OpenAPI::toStringValue(pet_id));
fullPath.replace(pet_idPathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(pet_id)));
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker();
OAIHttpRequestInput input(fullPath, "GET");
@ -419,7 +419,7 @@ OAIPetApi::updatePetWithForm(const qint64& pet_id, const QString& name, const QS
fullPath.append(this->host).append(this->basePath).append("/pet/{petId}");
QString pet_idPathParam("{");
pet_idPathParam.append("petId").append("}");
fullPath.replace(pet_idPathParam, ::OpenAPI::toStringValue(pet_id));
fullPath.replace(pet_idPathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(pet_id)));
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker();
OAIHttpRequestInput input(fullPath, "POST");
@ -472,7 +472,7 @@ OAIPetApi::uploadFile(const qint64& pet_id, const QString& additional_metadata,
fullPath.append(this->host).append(this->basePath).append("/pet/{petId}/uploadImage");
QString pet_idPathParam("{");
pet_idPathParam.append("petId").append("}");
fullPath.replace(pet_idPathParam, ::OpenAPI::toStringValue(pet_id));
fullPath.replace(pet_idPathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(pet_id)));
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker();
OAIHttpRequestInput input(fullPath, "POST");

View File

@ -37,7 +37,7 @@ OAIStoreApi::deleteOrder(const QString& order_id) {
fullPath.append(this->host).append(this->basePath).append("/store/order/{orderId}");
QString order_idPathParam("{");
order_idPathParam.append("orderId").append("}");
fullPath.replace(order_idPathParam, ::OpenAPI::toStringValue(order_id));
fullPath.replace(order_idPathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(order_id)));
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker();
OAIHttpRequestInput input(fullPath, "DELETE");
@ -138,7 +138,7 @@ OAIStoreApi::getOrderById(const qint64& order_id) {
fullPath.append(this->host).append(this->basePath).append("/store/order/{orderId}");
QString order_idPathParam("{");
order_idPathParam.append("orderId").append("}");
fullPath.replace(order_idPathParam, ::OpenAPI::toStringValue(order_id));
fullPath.replace(order_idPathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(order_id)));
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker();
OAIHttpRequestInput input(fullPath, "GET");

View File

@ -183,7 +183,7 @@ OAIUserApi::deleteUser(const QString& username) {
fullPath.append(this->host).append(this->basePath).append("/user/{username}");
QString usernamePathParam("{");
usernamePathParam.append("username").append("}");
fullPath.replace(usernamePathParam, ::OpenAPI::toStringValue(username));
fullPath.replace(usernamePathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(username)));
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker();
OAIHttpRequestInput input(fullPath, "DELETE");
@ -230,7 +230,7 @@ OAIUserApi::getUserByName(const QString& username) {
fullPath.append(this->host).append(this->basePath).append("/user/{username}");
QString usernamePathParam("{");
usernamePathParam.append("username").append("}");
fullPath.replace(usernamePathParam, ::OpenAPI::toStringValue(username));
fullPath.replace(usernamePathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(username)));
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker();
OAIHttpRequestInput input(fullPath, "GET");
@ -384,7 +384,7 @@ OAIUserApi::updateUser(const QString& username, const OAIUser& body) {
fullPath.append(this->host).append(this->basePath).append("/user/{username}");
QString usernamePathParam("{");
usernamePathParam.append("username").append("}");
fullPath.replace(usernamePathParam, ::OpenAPI::toStringValue(username));
fullPath.replace(usernamePathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(username)));
OAIHttpRequestWorker *worker = new OAIHttpRequestWorker();
OAIHttpRequestInput input(fullPath, "PUT");