http-builder-ng icon indicating copy to clipboard operation
http-builder-ng copied to clipboard

Should Chained URI query parameters be merged?

Open PredatorVI opened this issue 7 years ago • 1 comments

I'm using http-builder-ng v1.0.3 and have the following code:

    def nexusRequest = HttpBuilder.configure {
        ignoreSslIssues execution
        request.uri = BASE_URL
        request.uri.query.put("repository", REPOSITORY)
        request.uri.query.put("maven.groupId", POM_GROUPID)
        request.uri.query.put("maven.artifactId", POM_ARTIFACTID)
        request.uri.query.put("maven.baseVersion", POM_VERSION)
    }

     nexusRequest.get {
            request.accept = JSON[0]
            request.contentType = JSON[0]
            request.uri.path = SEARCH_PATH
            request.uri.query.put("maven.extension", POM_PACKAGING)

            response.success { FromServer from, Object body ->
                 //Do stuff
            }

            response.failure { FromServer from, Object body ->
                  //Handle error
            }
        }
    }

I was under the impression that the query parameters added in the HttpBuilder.configure() section would be merged with those added in the get() section.

However, the query parameters from the configure() section are not included in the GET request. Did I do it wrong or misunderstand how it works?

Thanks!!

PredatorVI avatar Jan 16 '19 17:01 PredatorVI

Yes, they should be merged. I have tagged this as a bug.

cjstehno avatar Jan 16 '19 18:01 cjstehno