https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
h

Hossein Amini

06/28/2021, 11:29 AM
Hi everyone! In KMM project using Ktor, when I want to pass an access token to the header of a request I get this exception:
io.ktor.client.features.ClientRequestException
.  This is my code:
Copy code
httpClient.request("https://...") {
    method = <http://HttpMethod.Post|HttpMethod.Post>

    header("Authorization", "access token")
}
What’s wrong with this code?
b

bsimmons

06/28/2021, 11:52 AM
What's the exception message?
h

Hossein Amini

06/28/2021, 12:03 PM
@bsimmons The problem was me. In addition to the ktor header I was sending a null token for all requests using Okhttp Interceptor. By deleting the interceptor the problem fixed. Thank you
👍 1