File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
kafka-connect-fitbit-source/src/main/java/org/radarbase/connect/rest/fitbit/user Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -240,7 +240,10 @@ class ServiceUserRepository : UserRepository {
240240 ): T = withContext(Dispatchers .IO ) {
241241 val response = client.request(builder)
242242 val contentLength = response.contentLength()
243- val hasBody = contentLength != null && contentLength > 0
243+ // if Transfer-Encoding: chunked, then the request has data but contentLength will be null.
244+ val transferEncoding = response.headers[" Transfer-Encoding" ]
245+ val hasBody = (contentLength != null && contentLength > 0 ) ||
246+ (transferEncoding != null && transferEncoding.contains(" chunked" ))
244247 if (response.status == HttpStatusCode .NotFound ) {
245248 throw NoSuchElementException (" URL " + response.request.url + " does not exist" )
246249 } else if (! response.status.isSuccess() || ! hasBody) {
You can’t perform that action at this time.
0 commit comments