[R] url-encode path parameters (#2397)

* url encode path parameter

* convert number to string before encoding
This commit is contained in:
William Cheng 2019-03-14 20:54:10 +08:00 committed by GitHub
parent 065bbc7bdb
commit 5ba35ecd31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 10 deletions

View File

@ -78,7 +78,7 @@
{{#hasPathParams}}
{{#pathParams}}
if (!missing(`{{paramName}}`)) {
urlPath <- gsub(paste0("\\{", "{{baseName}}", "\\}"), `{{paramName}}`, urlPath)
urlPath <- gsub(paste0("\\{", "{{baseName}}", "\\}"), URLencode(as.character(`{{paramName}}`), reserved = TRUE), urlPath)
}
{{/pathParams}}

View File

@ -104,7 +104,7 @@ PetApi <- R6::R6Class(
urlPath <- "/pet/{petId}"
if (!missing(`pet.id`)) {
urlPath <- gsub(paste0("\\{", "petId", "\\}"), `pet.id`, urlPath)
urlPath <- gsub(paste0("\\{", "petId", "\\}"), URLencode(as.character(`pet.id`), reserved = TRUE), urlPath)
}
# OAuth token
@ -199,7 +199,7 @@ PetApi <- R6::R6Class(
urlPath <- "/pet/{petId}"
if (!missing(`pet.id`)) {
urlPath <- gsub(paste0("\\{", "petId", "\\}"), `pet.id`, urlPath)
urlPath <- gsub(paste0("\\{", "petId", "\\}"), URLencode(as.character(`pet.id`), reserved = TRUE), urlPath)
}
# API key authentication
@ -274,7 +274,7 @@ PetApi <- R6::R6Class(
urlPath <- "/pet/{petId}"
if (!missing(`pet.id`)) {
urlPath <- gsub(paste0("\\{", "petId", "\\}"), `pet.id`, urlPath)
urlPath <- gsub(paste0("\\{", "petId", "\\}"), URLencode(as.character(`pet.id`), reserved = TRUE), urlPath)
}
# OAuth token
@ -312,7 +312,7 @@ PetApi <- R6::R6Class(
urlPath <- "/pet/{petId}/uploadImage"
if (!missing(`pet.id`)) {
urlPath <- gsub(paste0("\\{", "petId", "\\}"), `pet.id`, urlPath)
urlPath <- gsub(paste0("\\{", "petId", "\\}"), URLencode(as.character(`pet.id`), reserved = TRUE), urlPath)
}
# OAuth token

View File

@ -55,7 +55,7 @@ StoreApi <- R6::R6Class(
urlPath <- "/store/order/{orderId}"
if (!missing(`order.id`)) {
urlPath <- gsub(paste0("\\{", "orderId", "\\}"), `order.id`, urlPath)
urlPath <- gsub(paste0("\\{", "orderId", "\\}"), URLencode(as.character(`order.id`), reserved = TRUE), urlPath)
}
@ -113,7 +113,7 @@ StoreApi <- R6::R6Class(
urlPath <- "/store/order/{orderId}"
if (!missing(`order.id`)) {
urlPath <- gsub(paste0("\\{", "orderId", "\\}"), `order.id`, urlPath)
urlPath <- gsub(paste0("\\{", "orderId", "\\}"), URLencode(as.character(`order.id`), reserved = TRUE), urlPath)
}

View File

@ -166,7 +166,7 @@ UserApi <- R6::R6Class(
urlPath <- "/user/{username}"
if (!missing(`username`)) {
urlPath <- gsub(paste0("\\{", "username", "\\}"), `username`, urlPath)
urlPath <- gsub(paste0("\\{", "username", "\\}"), URLencode(as.character(`username`), reserved = TRUE), urlPath)
}
@ -197,7 +197,7 @@ UserApi <- R6::R6Class(
urlPath <- "/user/{username}"
if (!missing(`username`)) {
urlPath <- gsub(paste0("\\{", "username", "\\}"), `username`, urlPath)
urlPath <- gsub(paste0("\\{", "username", "\\}"), URLencode(as.character(`username`), reserved = TRUE), urlPath)
}
@ -296,7 +296,7 @@ UserApi <- R6::R6Class(
urlPath <- "/user/{username}"
if (!missing(`username`)) {
urlPath <- gsub(paste0("\\{", "username", "\\}"), `username`, urlPath)
urlPath <- gsub(paste0("\\{", "username", "\\}"), URLencode(as.character(`username`), reserved = TRUE), urlPath)
}