Skip to content

Commit

Permalink
Fixed header redirect test that was randomly failing by using ephemer…
Browse files Browse the repository at this point in the history
…al session.
  • Loading branch information
cnoon committed Sep 26, 2015
1 parent 2cb2395 commit e4864ea
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Tests/ResponseTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,9 @@ class RedirectResponseTestCase: BaseTestCase {
// header. It appears that Apple's strips the `Authorization` header from the redirected URL request. If you
// need to maintain the `Authorization` header, you need to manually append it to the redirected request.

Alamofire.Manager.sharedInstance.delegate.taskWillPerformHTTPRedirection = { session, task, response, request in
let manager = Manager(configuration: NSURLSessionConfiguration.ephemeralSessionConfiguration())

manager.delegate.taskWillPerformHTTPRedirection = { session, task, response, request in
var redirectedRequest = request

if let
Expand All @@ -506,7 +508,7 @@ class RedirectResponseTestCase: BaseTestCase {
var response: Response<AnyObject, NSError>?

// When
Alamofire.request(.GET, URLString, headers: headers)
manager.request(.GET, URLString, headers: headers)
.responseJSON { closureResponse in
response = closureResponse
expectation.fulfill()
Expand Down

0 comments on commit e4864ea

Please sign in to comment.