Skip to content

Commit

Permalink
Merge pull request #139 from RADAR-base/fix-get-users
Browse files Browse the repository at this point in the history
Fix get users
  • Loading branch information
Bdegraaf1234 authored Jul 9, 2024
2 parents 8b6360a + 78c20fe commit ef2f2f8
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,10 @@ class ServiceUserRepository : UserRepository {
): T = withContext(Dispatchers.IO) {
val response = client.request(builder)
val contentLength = response.contentLength()
val hasBody = contentLength != null && contentLength > 0
// if Transfer-Encoding: chunked, then the request has data but contentLength will be null.
val transferEncoding = response.headers["Transfer-Encoding"]
val hasBody = (contentLength != null && contentLength > 0) ||
(transferEncoding != null && transferEncoding.contains("chunked"))
if (response.status == HttpStatusCode.NotFound) {
throw NoSuchElementException("URL " + response.request.url + " does not exist")
} else if (!response.status.isSuccess() || !hasBody) {
Expand Down

0 comments on commit ef2f2f8

Please sign in to comment.