{title:'Request Parts', created:'8.2.0', updated:'9.0.0'}

Per-client or per-request HTTP parts (headers, query/form data, path parameters) can be manipulated via the following methods that return back builders for those parts:

- {@link oajrc.RestClient.Builder}
  - {@link oajrc.RestClient.Builder#headers() headers()}
  - {@link oajrc.RestClient.Builder#formData() formData()}
  - {@link oajrc.RestClient.Builder#queryData() queryData()}
  - {@link oajrc.RestClient.Builder#pathData() pathData()}
- {@link oajrc.RestRequest}
  - {@link oajrc.RestRequest#getHeaders() getHeaders()}
  - {@link oajrc.RestRequest#getFormData() getFormData()}
  - {@link oajrc.RestRequest#getQueryData() getQueryData()}
  - {@link oajrc.RestRequest#getPathData() getPathData()}

Convenience methods are also provided for quickly adding parts:

- {@link oajrc.RestClient.Builder}
  - {@link oajrc.RestClient.Builder#header(String,String) header(String,String)}
  - {@link oajrc.RestClient.Builder#header(String,Supplier) header(String,Supplier<String>)}
  - {@link oajrc.RestClient.Builder#headers(Header...) headers(Header...)}
  - {@link oajrc.RestClient.Builder#headersDefault(Header...) headersDefault(Header...)}
  - {@link oajrc.RestClient.Builder#formData(NameValuePair...) formData(NameValuePair...)}
  - {@link oajrc.RestClient.Builder#formData(String,String) formData(String,String)}
  - {@link oajrc.RestClient.Builder#formData(String,Supplier) formData(String,Supplier<String>)}
  - {@link oajrc.RestClient.Builder#formDataDefault(NameValuePair...) formDataDefault(NameValuePair...)}
  - {@link oajrc.RestClient.Builder#queryData(NameValuePair...) queryData(NameValuePair...)}
  - {@link oajrc.RestClient.Builder#queryData(String,String) queryData(String,String)}
  - {@link oajrc.RestClient.Builder#queryData(String,Supplier) queryData(String,Supplier<String>)}
  - {@link oajrc.RestClient.Builder#queryDataDefault(NameValuePair...) queryDataDefault(NameValuePair...)}
  - {@link oajrc.RestClient.Builder#pathData(NameValuePair...) pathData(NameValuePair...)}
  - {@link oajrc.RestClient.Builder#pathData(String,String) pathData(String,String)}
  - {@link oajrc.RestClient.Builder#pathData(String,Supplier) pathData(String,Supplier<String>)}
  - {@link oajrc.RestClient.Builder#pathDataDefault(NameValuePair...) pathDataDefault(NameValuePair...)}
- {@link oajrc.RestRequest}
  - {@link oajrc.RestRequest#header(Header) header(Header)}
  - {@link oajrc.RestRequest#header(String,Object) header(String,Object)}
  - {@link oajrc.RestRequest#headerPairs(String...) headerPairs(String...)}
  - {@link oajrc.RestRequest#headers(Header...) headers(Header...)}
  - {@link oajrc.RestRequest#headersBean(Object) headersBean(Object)}
  - {@link oajrc.RestRequest#formData(NameValuePair...) formData(NameValuePair...)}
  - {@link oajrc.RestRequest#formData(String,Object) formData(String,Object)}
  - {@link oajrc.RestRequest#formDataBean(Object) formDataBean(Object)}
  - {@link oajrc.RestRequest#formDataCustom(Object) formDataCustom(Object)}
  - {@link oajrc.RestRequest#formDataPairs(String...) formDataPairs(String...)}
  - {@link oajrc.RestRequest#queryData(NameValuePair...) queryData(NameValuePair...)}
  - {@link oajrc.RestRequest#queryData(String,Object) queryData(String,Object)}
  - {@link oajrc.RestRequest#queryDataBean(Object) queryDataBean(Object)}
  - {@link oajrc.RestRequest#queryDataPairs(String...) queryDataPairs(String...)}
  - {@link oajrc.RestRequest#pathData(NameValuePair...) pathData(NameValuePair...)}
  - {@link oajrc.RestRequest#pathData(String,Object) pathData(String,Object)}
  - {@link oajrc.RestRequest#pathDataBean(Object) pathDataBean(Object)}
  - {@link oajrc.RestRequest#pathDataPairs(String...) pathDataPairs(String...)}

##### Example:

| // Create a client that adds a "Foo: bar" header to every request. | RestClient client = RestClient.create().header("Foo","bar").build(); | | // Or do it on every request. | String response = client.get(URI).header("Foo","bar").run().getContent().asString();

The supplier methods are particularly useful for header values whose values may change over time (such as Authorization headers which may need to change every few minutes).

##### Example:

| // Create a client that adds a dynamic Authorization header to every request. | RestClient client = RestClient.create().header("Authorization", ()->getMyAuthToken()).build();

- {@link oaj.http.header} - Predefined {@link org.apache.http.Header} beans.