Skip to content

Commit

Permalink
Don't cache responses with 0 content length
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 openhab#3733

Signed-off-by: mueller-ma <[email protected]>
  • Loading branch information
mueller-ma committed Jul 11, 2024
1 parent 13a7929 commit d81282f
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 d81282f

Please sign in to comment.