Skip to content

Commit

Permalink
Based on prior PR which went stale:
Browse files Browse the repository at this point in the history
#70 by https://github.com/ocurr

Goal:
Expose currentRequest which should be expected given URLSessionDataTask subclass

Reasoning:
By exposing currentTask,  SessionDataTask can provide request for easy logging support

Changes:
- Provide currentRequest override + test
  • Loading branch information
Dane Miluski committed Nov 5, 2019
1 parent 7cfc451 commit 291e5e4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Sources/DVR/SessionDataTask.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ final class SessionDataTask: URLSessionDataTask {
return interaction?.response
}

override var currentRequest: URLRequest? {
return request
}


// MARK: - Initializers

Expand Down
2 changes: 2 additions & 0 deletions Tests/DVRTests/SessionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class SessionTests: XCTestCase {
} else {
XCTFail()
}

XCTAssertEqual(dataTask.currentRequest?.url?.absoluteString, request.url?.absoluteString)
}

func testDataTaskWithCompletion() {
Expand Down

0 comments on commit 291e5e4

Please sign in to comment.