Hi! Is there an example how to set `credentials: i...
# ktor
k
Hi! Is there an example how to set
credentials: include
(https://github.com/ktorio/ktor/pull/4793) for all requests? It would be great to have more real world example for Js, including setting auth headers etc. Current example is pretty minimal.
I think this will work for my usecase:
Copy code
val jsHttpClient = HttpClient(Js) {
        engine {
            configureRequest {
                credentials = "include"
            }
        }

        defaultRequest {
            headers {
                customHttpHeaders.forEach { (key, value) ->
                    append(key, value)
                }
            }
        }
    }
a
Also, you can use the
fetchOptions
method for the per-request configuration. I've included an example here.