post
A version of post that accepts a serializable body.
Use bodyAs on the returned Response if you want to deserialize returned bytes, e.g. post<RequestClass>(/*...*/).bodyAs<ReplyClass>().
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.http.post
import com.varabyte.kobweb.browser.http.FetchDefaults
import com.varabyte.kobweb.browser.http.bodyAs
import kotlinx.serialization.serializer
post(resource, body, headers, redirect, abortController, bodySerializer).bodyAs(responseDeserializer)Call POST on a target resource with R as the expected return type.
You can set R to Unit if this request doesn't expect a response body.
See also tryPost, which will return null if the request fails.
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.http.post
import com.varabyte.kobweb.browser.http.FetchDefaults
import com.varabyte.kobweb.browser.http.bodyAs
import kotlinx.serialization.serializer
post(resource, body = null, headers, redirect, abortController, bodySerializer).bodyAs(responseDeserializer)A serialize-friendly version of post that has no body but provides a serialized response.