options
inline suspend fun <R> ApiFetcher.options(apiPath: String, headers: Map<String, Any>? = FetchDefaults.Headers, redirect: RequestRedirect? = FetchDefaults.Redirect, abortController: AbortController? = null, responseDeserializer: DeserializationStrategy<R> = serializer()): R(source)
Deprecated
With these serialization-aware network methods, we are moving response deserialization handling to a separate `bodyAs` call. This lets us accomplish the same amount of functionality with fewer methods.
Replace with
import com.varabyte.kobweb.browser.options
import com.varabyte.kobweb.browser.http.FetchDefaults
import com.varabyte.kobweb.browser.http.bodyAs
import kotlinx.serialization.serializer
Content copied to clipboard
options(apiPath, headers, redirect, abortController).bodyAs(responseDeserializer)Content copied to clipboard
Call OPTIONS on a target API path with R as the expected return type.
You can set R to Unit if this request doesn't expect a response body.
See also tryOptions, which will return null if the request fails.
Note: you should NOT prepend your path with "api/", as that will be added automatically.