https://kotlinlang.org logo
r

Robert Jaros

10/31/2019, 10:33 PM
RestClient is internally based on jQuery ajax() https://api.jquery.com/jquery.ajax/ and to add headers to your request you can use
beforeSend
parameter:
Copy code
val resultPromise = client.remoteCall("<http://example.com/post_endpoint>", obj { value = "test" }, <http://HttpMethod.POST|HttpMethod.POST>, beforeSend = { xhr, _ ->
    xhr.setRequestHeader("Authorization", "Bearer token")
    true
})