Skip to content

Commit

Permalink
Don't cache responses with 0 content length (#3743)
Browse files Browse the repository at this point in the history
I noticed that myopenhab.org sometimes returns http code 200 for an icon and a valid svg content type, but the content length is 0. In that case, change to http code to 500 to avoid caching.

Fixes #3733

Signed-off-by: mueller-ma <[email protected]>
  • Loading branch information
mueller-ma authored Jul 16, 2024
1 parent 922fbef commit d8c8e2d
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ class HttpClient(client: OkHttpClient, baseUrl: String?, username: String?, pass
HttpException(call.request(), url, response.message, response.code)
)
}
body == null -> {
body == null || body.contentLength() == 0L -> {
cont.resumeWithException(HttpException(call.request(), url, "Empty body", 500))
}
else -> {
Expand Down

0 comments on commit d8c8e2d

Please sign in to comment.