Protocols

The following protocols are available globally.

  • The AFURLRequestSerialization protocol is adopted by an object that encodes parameters for a specified HTTP requests. Request serializers may encode parameters as query strings, HTTP bodies, setting the appropriate HTTP header fields as necessary.

    For example, a JSON request serializer may set the HTTP body of the request to a JSON representation, and set the Content-Type HTTP header field value to application/json.

    See more

    Declaration

    Objective-C

    @protocol AFURLRequestSerialization <NSObject, NSSecureCoding, NSCopying>

    Swift

    protocol AFURLRequestSerialization : NSCopying, NSSecureCoding, NSObjectProtocol
  • The AFMultipartFormData protocol defines the methods supported by the parameter in the block argument of AFHTTPRequestSerializer -multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:.

    See more

    Declaration

    Objective-C

    @protocol AFMultipartFormData

    Swift

    protocol AFMultipartFormData
  • The AFURLResponseSerialization protocol is adopted by an object that decodes data into a more useful object representation, according to details in the server response. Response serializers may additionally perform validation on the incoming response and data.

    For example, a JSON response serializer may check for an acceptable status code (2XX range) and content type (application/json), decoding a valid JSON response into an object.

    See more

    Declaration

    Objective-C

    @protocol AFURLResponseSerialization <NSObject, NSSecureCoding, NSCopying>

    Swift

    protocol AFURLResponseSerialization : NSCopying, NSSecureCoding, NSObjectProtocol