You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Changes
#138 changed the CommonsHttpClient implementation to use
`InputStreamEntity` for all request bodies sent using the Java SDK. As a
result, requests are sent with a `Transfer-Encoding: chunked` header,
and the request body is chunked accordingly. However, the Databricks
REST API only tolerates chunked requests for certain APIs; for others,
it ignores the request body if Content-Length is not specified. Auth
falls under that category, which caused #154.
To fix this, Request will keep track of string entities and input stream
entities separately. Previously, Request had separate fields for the
body and debugBody, but they were both always set, so it wasn't possible
to distinguish between these two cases. Now, HTTP clients can have
different behavior based on whether the request body can be fully
materialized as a string or is lazily read as with input streams.
As part of this, I have removed `SimpleHttpServer`. This was used before
we were sure whether it was possible to use the HttpServer built into
the JDK. Now that we are confident that we can (see usage in
ExternalBrowserCredentialsProvider.java), I've replaced it with
HttpServer and a custom HttpHandler in FixtureServer (the only place
where it is used now).
One other small change: I've updated the logging configuration and
dependency for the cli auth demo app. This ensures that users can see
debug output (which I used when debugging this).
Closes#154.
## Tests
I've refactored FixtureServer to support more advanced validation on the
HTTP requests sent by clients for testing purposes. Now, users can
assert that a request has a specific method, path, headers, body, and
check for headers that should not be present.
One downside of this change is that users need to call the `.with()`
method once per API call, rather than one time, at the start of each
test.
Unit tests cover both cases (request body should be chunked when
specified as a String; request body should not be chunked when specified
as an InputStream).
0 commit comments