LCURLRequestSerialization
Objective-C
@protocol LCURLRequestSerialization <NSObject, NSSecureCoding, NSCopying>
Swift
protocol LCURLRequestSerialization : NSCopying, NSSecureCoding, NSObjectProtocol
The LCURLRequestSerialization
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
.
-
Returns a request with the specified parameters encoded into a copy of the original request.
Declaration
Objective-C
- (nullable NSURLRequest *) requestBySerializingRequest:(nonnull NSURLRequest *)request withParameters:(nullable id)parameters error:(NSError *_Nullable *_Nullable)error;
Swift
func request(bySerializingRequest request: URLRequest, withParameters parameters: Any?, error: NSErrorPointer) -> URLRequest?
Parameters
request
The original request.
parameters
The parameters to be encoded.
error
The error that occurred while attempting to encode the request parameters.
Return Value
A serialized request.