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
See moreContent-Type
HTTP header field value toapplication/json
.Declaration
Objective-C
@protocol AFURLRequestSerialization <NSObject, NSSecureCoding, NSCopying>
Swift
protocol AFURLRequestSerialization : NSCopying, NSSecureCoding, NSObjectProtocol
-
The
See moreAFMultipartFormData
protocol defines the methods supported by the parameter in the block argument ofAFHTTPRequestSerializer -multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:
.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 (
See more2XX
range) and content type (application/json
), decoding a valid JSON response into an object.Declaration
Objective-C
@protocol AFURLResponseSerialization <NSObject, NSSecureCoding, NSCopying>
Swift
protocol AFURLResponseSerialization : NSCopying, NSSecureCoding, NSObjectProtocol