-
-
Notifications
You must be signed in to change notification settings - Fork 377
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
62 additions
and
39 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#### Alamofire workaround | ||
|
||
Due to the way Alamofire uses NSURLSession, you’ll need to do a little more than the standard installation to monitor all requests. The simplest way to do this is to create a subclass of Manager to handle your requests as this | ||
|
||
<pre> | ||
import Alamofire | ||
|
||
class NFXManager: Alamofire.Manager | ||
{ | ||
static let sharedManager: NFXManager = { | ||
let configuration = NSURLSessionConfiguration.defaultSessionConfiguration() | ||
configuration.protocolClasses?.insert(NFXProtocol.self, atIndex: 0) | ||
let manager = NFXManager(configuration: configuration) | ||
return manager | ||
}() | ||
} | ||
</pre> | ||
|
||
Then just use NFXManager.sharedManager instead of Alamofire.request() | ||
|
||
#### No HTTP body for requests | ||
|
||
Unfortunately, due to a limitation in NSURLProtocol, netfox is unable to log the HTTP body of some requests (check [this](http://openradar.appspot.com/15993891) radar for more details) | ||
|
||
[jasoncabot](https://github.com/jasoncabot) posted a nice workaround on this: | ||
|
||
You can do the following to monitor these requests | ||
<pre> | ||
if let bodyData = mutableURLRequest.HTTPBody { | ||
NSURLProtocol.setProperty(bodyData, forKey: "NFXBodyData", inRequest: mutableURLRequest) | ||
} | ||
</pre> | ||
|
||
Tip for Alamofire users: Subclass URLRequestConvertible and make all the work there |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters