tryPatchBytes

inline suspend fun <B> ApiFetcher.tryPatchBytes(apiPath: String, body: B, headers: Map<String, Any>? = FetchDefaults.Headers, redirect: RequestRedirect? = FetchDefaults.Redirect, abortController: AbortController? = null, bodySerializer: SerializationStrategy<B> = serializer()): ByteArray?(source)

Deprecated

We are phasing out the *Bytes version of network requests, now that we have new versions that return `Response` objects directly.

Replace with

import com.varabyte.kobweb.browser.tryPatch
import com.varabyte.kobweb.browser.http.FetchDefaults
import com.varabyte.kobweb.browser.http.bodyAsBytes
import kotlinx.serialization.serializer
tryPatch(apiPath, body, headers, redirect, abortController, bodySerializer) { bodyAsBytes() }

A serialize-friendly version of tryPatch that accepts a serializable body and returns its response as a raw byte array.

Note: you should NOT prepend your path with "api/", as that will be added automatically.