Skip to content

Commit

Permalink
Fix #2090: avoid bang bang operator in networkinterceptor (#2091)
Browse files Browse the repository at this point in the history
* removed bang bang operator in NetworkInterceptor.kt and used let for null check

* renamed it to responseBody for higher order function
  • Loading branch information
prudhvir3ddy authored Nov 8, 2020
1 parent 39ade7b commit 3b3748f
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ class NetworkInterceptor @Inject constructor() : Interceptor {
val response = chain.proceed(request)

if (response.code() == Constants.HTTP_OK) {
if (response.body() != null) {
var rawJson = response.body()!!.string()
response.body()?.let { responseBody ->
var rawJson = responseBody.string()
rawJson = removeXSSIPrefix(rawJson)
val contentType = response.body()!!.contentType()
val contentType = responseBody.contentType()
val body = ResponseBody.create(contentType, rawJson)
return response.newBuilder().body(body).build()
}
Expand Down

0 comments on commit 3b3748f

Please sign in to comment.