Skip to content

Commit 055a3c3

Browse files
committed
return responseBody
1 parent 6fc5579 commit 055a3c3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

kotlin-insight-client/kotlin-insight-client-sdk/src/main/kotlin/com/linkedplanet/kotlininsightclient/sdk/SdkInsightAttachmentOperator.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ object SdkInsightAttachmentOperator : InsightAttachmentOperator {
7272
val request = trustedGetRequestForCurrentUser(url).bind()
7373
val response = Either.catch { request.executeAndReturn<Response> { it } as Response }
7474
.mapLeft { downloadFailed(500, url) }.bind()
75-
if (response.isSuccessful) {
76-
response.responseBodyAsStream
75+
if (!response.isSuccessful) {
76+
raise(downloadFailed(response.statusCode, url))
7777
}
78-
raise(downloadFailed(response.statusCode, url))
78+
response.responseBodyAsStream
7979
}
8080

8181
private fun downloadFailed(statusCode: Int, url: String, ) = HttpInsightClientError(

0 commit comments

Comments
 (0)