RequestBody

public protocol RequestBody : Encodable, Sendable

A protocol used for structs to be sent with Requests.

  • jsonData Default implementation

    A 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 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).

    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