Skip to content

Instantly share code, notes, and snippets.

@stuntgoat
Created November 26, 2011 01:59
Show Gist options
  • Save stuntgoat/1394827 to your computer and use it in GitHub Desktop.
Save stuntgoat/1394827 to your computer and use it in GitHub Desktop.
Portion of an example as demonstrated in using NSURLConnection Delegate
// MyHTTPRequest.h
@interface MyHttpRequest : NSObject {
// The following 3 class attributes are saved as the initial request is created.
// If a redirect occurs, these attributes will be used to copy to the last redirected request,
// only if the URL is the same as the initial request's URL
NSData *requestBodyData;
NSString *requestMethod; // POST or GET
NSURL *requestURL; // initial request's URL
// other attributes omitted
}
// notice we 'copy' the NSData. This will be the original request's HTTPBody
@property (nonatomic, copy) NSData *requestBodyData;
@property (nonatomic, retain) NSString *requestMethod;
@property (nonatomic, retain) NSURL *requestURL;
// other attributes omitted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment