This commit updates the short connect timeout tests to tolerate either a
ConnectException or SocketTimeoutException as a success condition.
Connections could fail with either exception depending upon timing or
network setup.
This commit enables http clients to optionally configure a connect
and/or socket timeout for requests. For persistent clients, the
timeout values can only be configured at the client and not a
per-request level. Non-persistent client requests support the
configuration of these timeouts.
This commit also bumps a few dependencies - tk-jetty9 to 1.2.0,
trapperkeeper to 1.10, ssl-utils to 0.8.0, and clojure to 1.6.0 -
and adds the 'test' tk-jetty9 library as a dev dependency for
testing.
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.
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.