File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
src/commonMain/kotlin/com.adamratzman.spotify/http Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -243,13 +243,16 @@ public class HttpRequest constructor(
243243 }
244244
245245 override fun toString (): String {
246- return """ HttpConnection (
246+ // we don't want to print this sensitive information
247+ val headersWithoutAuthorization = headers.filter { it.key != " Authorization" }
248+ val hasAuthorizationHeader = headersWithoutAuthorization.size != headers.size
249+ return """ HttpConnection(
247250 |url=$url ,
248251 |method=$method ,
249252 |body=${bodyString ? : bodyMap} ,
250253 |contentType=$contentType ,
251- |headers=${headers .toList()}
252- | )
254+ |headers=${headersWithoutAuthorization .toList()}
255+ |${ if (hasAuthorizationHeader) " The authorization header was hidden. " else " There was no authorization header. " } )
253256 """ .trimMargin()
254257 }
255258
You can’t perform that action at this time.
0 commit comments