RequestBody
public protocol RequestBody : Encodable, Sendable
A protocol used for structs to be sent with Requests.
-
jsonDataDefault implementationA JSON representation of the struct.
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 implementationA JSON representation of the struct.
Throws
An error if the encoding process encounters an issue, such as invalid floating-point values (e.g., NaN, infinity).Default Implementation
A JSON representation of the struct.
Throws
An error if the encoding process encounters an issue, such as invalid floating-point values (e.g., NaN, infinity).Declaration
Swift
func getJsonData() throws -> Data
View on GitHub