tryPatch
Like patch, but returns null if the request failed for any reason.
Additionally, if HttpFetcher.logOnError is set to true, any failure will be logged to the console.
Parameters
The body to send with the request. Make sure your class is marked with @Serializable or provide a custom bodySerializer. Note that JSON is used as the serialization format, and if body is non-null, the Content-type
will automatically be set to application/json
(unless explicitly set by the user).
A serialize-friendly version of tryPatch that doesn't put any type constraints on the body.
This is useful if your request doesn't require a body to be included, so there shouldn't be a need to specify a body type constraint in that case, or if it is easier to use a custom, handcrafted byte array message instead.