Inherits from NSObject
Declared in MTPocketRequest.h

Overview

MTPocketRequest

Use the convenience constructors to create a request and then call send to make the request. The convenience constructors will give you a “template” for a common request, but you can always use the properties of this class to customize the request further.

Example: One shot

MTPocketResponse *response = [MTPocketRequest requestForURL:URL format:MTPocketFormatHTML].send;

Example: Customize

 MTPocketRequest *request = [MTPocketRequest requestForURL:URL method:MTPocketMethodPost format:MTPocketFormatJSON body:@{"Name" : "Adam"}];
 request.timeout = 60;
 [request send];

Properties

URL

@property (readonly) NSURL *URL

body

@property (strong, nonatomic) id body

format

@property (nonatomic) MTPocketFormat format

headers

@property (strong, nonatomic) NSDictionary *headers

method

@property (nonatomic) MTPocketMethod method

password

@property (strong, nonatomic) NSString *password

response

@property (strong, nonatomic) MTPocketResponse *response

timeout

@property (nonatomic) NSTimeInterval timeout

username

@property (strong, nonatomic) NSString *username

Class Methods

requestForURL:format:

+ (MTPocketRequest *)requestForURL:(NSURL *)URL format:(MTPocketFormat)format

requestForURL:method:format:body:

+ (MTPocketRequest *)requestForURL:(NSURL *)URL method:(MTPocketMethod)method format:(MTPocketFormat)format body:(id)body

requestForURL:method:format:username:password:body:

+ (MTPocketRequest *)requestForURL:(NSURL *)URL method:(MTPocketMethod)method format:(MTPocketFormat)format username:(NSString *)username password:(NSString *)password body:(id)body

Instance Methods

initWithURL:

- (id)initWithURL:(NSURL *)URL

requestWithResponse:

- (NSMutableURLRequest *)requestWithResponse:(MTPocketResponse **)response

send

- (MTPocketResponse *)send