Fix a bug in which a default charset of UTF-8 would be added to the
Content-Type header for certain requests. This change restricts that
behavior to cases in which the body is a string and there is no charset
provided by the caller.
Expand discussion of the `close` function for clojure clients and
the `close` method for Java clients. Add examples for making
requests with various types of clients. Fix wording/typos.
This commit restores several of the `rediret-test-async` tests, using a
client to make the requests since the client-less single-request async
APIs are no longer available.
This commit restores the `query-params-test-async` tests, using a client
to make the requests since the client-less single-request async APIs are
no longer available.
This commit removes the `request-with-reified-client` function in
async.clj in lieu of having clients just call the `request-with-client`
function.
This commit also restores documentation for the client and request
options to the `create-client` and `request-with-client` functions,
respectively. The documentation includes some updates for newer options
which are supported but not were not included in the code currently on
the master branch.
This commit removes some repeated code from the Clojure sync request
function and changes the surrounding try/catch/finally block to make use
of the Clojure `with-open` macro.
For both the Clojure and Java single request APIs, the internal
implementation now creates an http client, makes a request on it, and
calls close on the client when done. The close at the end avoids
resource leaks.
In support of this, the `JavaClient` class now requires the caller to
create an instance rather than just make a call to the static
`request` method on the `JavaClient` class.
The `coerceBodyType` method on the `JavaClient` class now closes the
body `InputStream` after coercing the stream content into a `String`.
This eliminates a possible resource leak and makes the Java-layer
coerce implementation consistent with the Clojure-layer coerce in
that the latter was already, via the use of the Clojure `slurp`
function, closing the stream content after coercing to `String`.
This commit removes the `AsyncClose` class and references to it. These
changes are in preparation for making the close call after the response
has been dereferenced - to be done in a later commit. The `persistent`
flag/option was also removed from request handling as it will no longer
be used for determining whether or not the client should be closed
following a request.
Remove the accessor for the method option in SimpleRequestOptions
and RequestOptions, as it would always be overridden by whichever
Java request method was called by the user.
Remove the client option from SimpleRequestOptions and
RequestOptions as it was not being used. Correct initialization
of the Logger in various classes to use the correct class.
Add a PersistentSyncHttpClient class, which is a wrapper around
CloseableHttpAsyncClient and allows multiple requests to be made
with a persistent synchronous client.
Separate the Java RequestOptions class into two new classes:
RequestOptions, which contains options related to the request,
and ClientOptions, which contains options related to the client.
Both are now required when calling the request methods in
AsyncHttpClient and SyncHttpClient.
The test code related to the configurable SSL protocols was
written using some ciphers that are available in OpenJDK, but
are not available by default in Oracle JDK. This caused the
tests to fail on Oracle JDKs.
This commit changes the test to use some older ciphers that
are available in the Oracle JDK out of the box.