Skip to content

Commit

Permalink
Sttp - wrap query params (#6884)
Browse files Browse the repository at this point in the history
* Wrap query params with additional curly braces

* Sttp - remove unused file
  • Loading branch information
ghostbuster91 authored Aug 8, 2020
1 parent 03a0dc7 commit 2a17625
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class {{classname}}(baseUrl: String) {
{{/javadocRenderer}}
def {{operationId}}({{>methodParameters}}): Request[{{#separateErrorChannel}}Either[ResponseError[Exception], {{>operationReturnType}}]{{/separateErrorChannel}}{{^separateErrorChannel}}{{>operationReturnType}}{{/separateErrorChannel}}, Nothing] =
basicRequest
.method(Method.{{httpMethod.toUpperCase}}, uri"$baseUrl{{{path}}}{{#queryParams.0}}?{{#queryParams}}{{baseName}}=${{{paramName}}}{{^-last}}&{{/-last}}{{/queryParams}}{{/queryParams.0}}{{#isApiKey}}{{#isKeyInQuery}}{{^queryParams.0}}?{{/queryParams.0}}{{#queryParams.0}}&{{/queryParams.0}}{{keyParamName}}=${apiKey.value}&{{/isKeyInQuery}}{{/isApiKey}}")
.method(Method.{{httpMethod.toUpperCase}}, uri"$baseUrl{{{path}}}{{#queryParams.0}}?{{#queryParams}}{{baseName}}=${ {{{paramName}}} }{{^-last}}&{{/-last}}{{/queryParams}}{{/queryParams.0}}{{#isApiKey}}{{#isKeyInQuery}}{{^queryParams.0}}?{{/queryParams.0}}{{#queryParams.0}}&{{/queryParams.0}}{{keyParamName}}=${apiKey.value}&{{/isKeyInQuery}}{{/isApiKey}}")
.contentType({{#consumes.0}}"{{{mediaType}}}"{{/consumes.0}}{{^consumes}}"application/json"{{/consumes}}){{#headerParams}}
.header({{>paramCreation}}){{/headerParams}}{{#authMethods}}{{#isBasic}}{{#isBasicBasic}}
.auth.withCredentials(username, password){{/isBasicBasic}}{{#isBasicBearer}}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class PetApi(baseUrl: String) {
def findPetsByStatus(status: Seq[String]
): Request[Either[ResponseError[Exception], Seq[Pet]], Nothing] =
basicRequest
.method(Method.GET, uri"$baseUrl/pet/findByStatus?status=$status")
.method(Method.GET, uri"$baseUrl/pet/findByStatus?status=${ status }")
.contentType("application/json")
.response(asJson[Seq[Pet]])

Expand All @@ -83,7 +83,7 @@ class PetApi(baseUrl: String) {
def findPetsByTags(tags: Seq[String]
): Request[Either[ResponseError[Exception], Seq[Pet]], Nothing] =
basicRequest
.method(Method.GET, uri"$baseUrl/pet/findByTags?tags=$tags")
.method(Method.GET, uri"$baseUrl/pet/findByTags?tags=${ tags }")
.contentType("application/json")
.response(asJson[Seq[Pet]])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class UserApi(baseUrl: String) {
def loginUser(username: String, password: String
): Request[Either[ResponseError[Exception], String], Nothing] =
basicRequest
.method(Method.GET, uri"$baseUrl/user/login?username=$username&password=$password")
.method(Method.GET, uri"$baseUrl/user/login?username=${ username }&password=${ password }")
.contentType("application/json")
.response(asJson[String])

Expand Down

0 comments on commit 2a17625

Please sign in to comment.