Skip to content
Permalink
Browse files

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

* url encode path parameter

* convert number to string before encoding
  • Loading branch information...
wing328 committed Mar 14, 2019
1 parent 065bbc7 commit 5ba35ecd31414ff7a841805ce86d77eda60a36ad
@@ -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}}
@@ -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
@@ -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)
}


@@ -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)
}


0 comments on commit 5ba35ec

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.