RequestBody
public protocol RequestBody : Encodable, Sendable
A protocol for request bodies that should be JSON encoded before sending.
-
jsonDataDefault implementationA JSON representation of the request body.
Default Implementation
Declaration
Swift
@available(*, deprecated, message: "Use getJsonData(﹚ instead. This property uses force-try and will crash if encoding fails (e.g., with NaN or infinity values﹚") var jsonData: Data { get } -
getJsonData()Default implementationEncodes the request body as JSON using Bagbutik’s default encoder configuration.
Throws
An error if encoding fails, for example because the body containsNaNor infinity values.Default Implementation
Encodes the request body as JSON using ISO 8601 dates.
Throws
An error if encoding fails, for example because the body containsNaNor infinity values.Declaration
Swift
func getJsonData() throws -> Data
View on GitHub