org.apache.sling.testing.tools.http

## Class RequestBuilder

- java.lang.Object
- - org.apache.sling.testing.tools.http.RequestBuilder

    public class RequestBuilder
    extends Object

Convenience builder for Request objects

### Constructor Summary

Constructors
Constructor and Description
`RequestBuilder(String baseUrl)`

### Method Summary

All Methods Instance Methods Concrete Methods
`Request` `buildGetRequest(String path, String... queryParameters)` Build a GET request to specified path with optional query parameters.
`Request` `buildOtherRequest(org.apache.http.client.methods.HttpRequestBase r)` Wrap supplied HTTP request
`Request` `buildPostRequest(String path)` Build a POST request to specified path with optional query parameters.
`String` `buildUrl(String path, String... queryParameters)` Build an URL from our base path, supplied path and optional query parameters.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### RequestBuilder

    public RequestBuilder(String baseUrl)

### Method Detail

#### buildGetRequest

    public Request buildGetRequest(String path,
                                   String... queryParameters)

Build a GET request to specified path with optional query parameters. See `buildUrl(String, String...)` for queryParameters semantics.

#### buildPostRequest

    public Request buildPostRequest(String path)

Build a POST request to specified path with optional query parameters. See `buildUrl(String, String...)` for queryParameters semantics.

#### buildOtherRequest

    public Request buildOtherRequest(org.apache.http.client.methods.HttpRequestBase r)

Wrap supplied HTTP request

#### buildUrl

    public String buildUrl(String path,
                           String... queryParameters)

Build an URL from our base path, supplied path and optional query parameters.

Parameters:
  `queryParameters` - an even number of Strings, each pair of values represents the key and value of a query parameter. Keys and values are encoded by this method.