Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 2 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ jobs:
fail-fast: false
matrix:
include:
- xcode: "Xcode_16.0"
- xcode: "Xcode_16.1"
runsOn: macOS-14
name: "macOS 14, Xcode 16.0, Swift 6.0"
name: "macOS 14, Xcode 16.1, Swift 6.0.2"
- xcode: "Xcode_15.4"
runsOn: macOS-14
name: "macOS 14, Xcode 15.4, Swift 5.10"
Expand Down Expand Up @@ -61,10 +61,6 @@ jobs:
name: "iOS 18.1"
xcode: "Xcode_16.1"
runsOn: macOS-14
- destination: "OS=18.0,name=iPhone 16 Pro"
name: "iOS 18.0"
xcode: "Xcode_16.0"
runsOn: macOS-14
- destination: "OS=17.5,name=iPhone 15 Pro"
name: "iOS 17.5"
xcode: "Xcode_15.4"
Expand Down Expand Up @@ -102,10 +98,6 @@ jobs:
name: "tvOS 18.1"
xcode: "Xcode_16.1"
runsOn: macOS-14
- destination: "OS=18.0,name=Apple TV"
name: "tvOS 18.0"
xcode: "Xcode_16.0"
runsOn: macOS-14
- destination: "OS=17.5,name=Apple TV"
name: "tvOS 17.5"
xcode: "Xcode_15.4"
Expand Down Expand Up @@ -143,10 +135,6 @@ jobs:
name: "watchOS 11.1"
xcode: "Xcode_16.1"
runsOn: macOS-14
- destination: "OS=11.0,name=Apple Watch Series 10 (46mm)"
name: "watchOS 11.0"
xcode: "Xcode_16.0"
runsOn: macOS-14
- destination: "OS=10.5,name=Apple Watch Series 9 (45mm)"
name: "watchOS 10.5"
xcode: "Xcode_15.4"
Expand Down Expand Up @@ -183,9 +171,6 @@ jobs:
- name: "macOS 14, SPM 6.0.2 Test"
xcode: "Xcode_16.1"
runsOn: macOS-14
- name: "macOS 14, SPM 6.0.0 Test"
xcode: "Xcode_16.0"
runsOn: macOS-14
- name: "macOS 14, SPM 5.9.0 Test"
xcode: "Xcode_15.0"
runsOn: macos-14
Expand Down
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
- `1.1.x` Release Candidates - [1.1.0-rc.1](#110-rc1)
- `1.0.x` Releases - [1.0.0](#100)

## [1.1.0-rc.2](https://github.com/space-code/network-layer/releases/tag/1.1.0-rc.2)
Released on 2025-05-30.

#### Fixed
- Fix adapting a request during retry.
- Fixed in Pull Request [#2](https://github.com/space-code/network-layer/pull/7).

## [1.1.0-rc.1](https://github.com/space-code/network-layer/releases/tag/1.1.0-rc.1)
Released on 2024-12-25.

Expand All @@ -16,7 +23,7 @@ Released on 2024-12-25.
- Fix the `inout` parameter in the `IAuthenticator` protocol
- Fixed in Pull Request [#2](https://github.com/space-code/network-layer/pull/2).
- Fix the package builiding.
- Fixed in Pull Request [#6](https://github.com/space-code/network-layer/pull-6).
- Fixed in Pull Request [#6](https://github.com/space-code/network-layer/pull/6).

## [1.0.0](https://github.com/space-code/network-layer/releases/tag/1.0.0)
Released on 2023-12-04.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// network-layer
// Copyright © 2023 Space Code. All rights reserved.
// Copyright © 2025 Space Code. All rights reserved.
//

import Foundation
Expand Down Expand Up @@ -75,15 +75,15 @@ actor RequestProcessor {
_ request: T,
strategy: RetryPolicyStrategy? = nil,
delegate: URLSessionDelegate?,
configure: ((inout URLRequest) throws -> Void)?
configure: (@Sendable (inout URLRequest) throws -> Void)?
) async throws -> Response<Data> {
guard var urlRequest = try requestBuilder.build(request, configure) else {
throw NetworkLayerError.badURL
}
try await performRequest(strategy: strategy) { [weak self] in
guard let self, var urlRequest = try requestBuilder.build(request, configure) else {
throw NetworkLayerError.badURL
}

try await adapt(request, urlRequest: &urlRequest, session: session)
try await adapt(request, urlRequest: &urlRequest, session: session)

return try await performRequest(strategy: strategy) { [urlRequest] in
try await self.delegate?.wrappedValue?.requestProcessor(self, willSendRequest: urlRequest)

let task = session.dataTask(with: urlRequest)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// network-layer
// Copyright © 2023 Space Code. All rights reserved.
// Copyright © 2025 Space Code. All rights reserved.
//

import Foundation
Expand All @@ -12,5 +12,5 @@ public protocol IRequestBuilder: Sendable {
/// - Parameter request: The request object that defines the request details.
///
/// - Returns: A `URLRequest` constructed based on the given data.
func build(_ request: IRequest, _ configure: ((inout URLRequest) throws -> Void)?) throws -> URLRequest?
func build(_ request: IRequest, _ configure: (@Sendable (inout URLRequest) throws -> Void)?) throws -> URLRequest?
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// network-layer
// Copyright © 2023 Space Code. All rights reserved.
// Copyright © 2025 Space Code. All rights reserved.
//

import Foundation
Expand Down Expand Up @@ -60,7 +60,11 @@ final class RequestProcessorAuthenicationTests: XCTestCase {
}

func test_thatRequestProcessorThrowsAnError_whenInterceptorAdaptDidFail() async throws {
try await test_failAuthentication(adaptError: URLError(.unknown), refreshError: nil, expectedError: URLError(.unknown))
try await test_failAuthentication(
adaptError: URLError(.unknown),
refreshError: nil,
expectedError: RetryPolicyError.retryLimitExceeded
)
}

func test_thatRequestProcessorThrowsAnError_whenInterceptorRefreshDidFail() async throws {
Expand Down