Skip to content

Commit

Permalink
Merge pull request #304 from ishkawa/feature/default-implementation-v…
Browse files Browse the repository at this point in the history
…oid-response

Added default implementation of `response(from:urlResponse:)` when Response is Void
  • Loading branch information
Econa77 authored Aug 13, 2022
2 parents 84955ed + a001b65 commit 9fad9ad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 6 additions & 0 deletions Sources/APIKit/Request.swift
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,9 @@ public extension Request {
return try response(from: passedObject, urlResponse: urlResponse)
}
}

public extension Request where Response == Void {
func response(from object: Any, urlResponse: HTTPURLResponse) throws {
return
}
}
4 changes: 0 additions & 4 deletions Tests/APIKitTests/SessionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,6 @@ class SessionTests: XCTestCase {
var path: String {
return "/"
}

func response(from object: Any, urlResponse: HTTPURLResponse) throws -> Response {
return ()
}
}

func testCancelOtherRequest() {
Expand Down

0 comments on commit 9fad9ad

Please sign in to comment.