mxcl/OMGHTTPURLRQ is a Objective-C project with 336 stars. Vital extensions to NSURLRequest that Apple left out for some reason.
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
You can then pass these to an NSURLConnection or NSURLSession.
multipart/form-data
OMG! Constructing multipart/form-data for POST requests is complicated, let us do it for you:
OMGMultipartFormData *multipartFormData = [OMGMultipartFormData new];
NSData *data1 = [NSData dataWithContentsOfFile:@"myimage1.png"];
[multipartFormData addFile:data1 parameterName:@"file1" filename:@"myimage1.png" contentType:@"image/png"];
// Ideally you would not want to re-encode the PNG, but often it is
// tricky to avoid it.
UIImage *image2 = [UIImage imageNamed:@"image2"];
NSData *data2 = UIImagePNGRepresentation(image2);
[multipartFormData addFile:data2 parameterName:@"file2" filename:@"myimage2.png" contentType:@"image/png"];
// SUPER Ideally you would not want to re-encode the JPEG as the process
// is lossy. If your image comes from the AssetLibrary you *CAN* get the
// original `NSData`. See stackoverflow.com.
UIImage *image3 = [UIImage imageNamed:@"image3"];
NSData *data3 = UIImageJPEGRepresentation(image3);
[multipartFormData addFile:data3 parameterName:@"file2" filename:@"myimage3.jpeg" contentType:@"image/jpeg"];
NSMutableURLRequest *rq = [OMGHTTPURLRQ POST:url:multipartFormData];
Now feed rq to [NSURLConnection sendSynchronousRequest:returningResponse:error:.
Configuring an NSURLSessionUploadTask
If you need to use NSURLSession’s uploadTask: but you have become frustrated because your endpoint expects a multipart/form-data POST request and NSURLSession sends the data raw, use this:
Yes — mxcl/OMGHTTPURLRQ ships under the MIT license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/mxcl/OMGHTTPURLRQ.
What is mxcl/OMGHTTPURLRQ?
mxcl/OMGHTTPURLRQ (mxcl/OMGHTTPURLRQ) is a Objective-C project on GitHub. From the project's own README: Vital extensions to NSURLRequest that Apple left out for some reason.
Where do I read more about mxcl/OMGHTTPURLRQ?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/mxcl/OMGHTTPURLRQ is the definitive source.
Read full README in the tab above.
Still deciding about OMGHTTPURLRQ?
One click hands the question to an AI along with this page — see what it says about OMGHTTPURLRQ.