File tree Expand file tree Collapse file tree
NetworkLayerInterfaces/Classes/Core/Authenticator
Classes/Core/Authentification
NetworkLayer.docc/Articles
Tests/NetworkLayerTests/Classes Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515 - name : ruby setup
1616 uses : ruby/setup-ruby@v1
1717 with :
18- ruby-version : 2.7
18+ ruby-version : 3.1.4
1919 bundler-cache : true
2020 - name : Checkout code
2121 uses : actions/checkout@v2
2828
2929 DANGER_GITHUB_API_TOKEN : ${{ secrets.DANGER_GITHUB_API_TOKEN }}
3030
31- run : bundle exec danger --verbose
31+ run : bundle exec danger --verbose
Original file line number Diff line number Diff line change 11# Change Log
22All notable changes to this project will be documented in this file.
33
4+ ## [ Unreleased]
5+
6+ ## Fixed
7+ - Fix the ` inout ` parameter in the ` IAuthenticator ` protocol
8+ - Fixed in Pull Request [ #2 ] ( https://github.com/space-code/network-layer/pull/2 ) .
9+
410#### 1.x Releases
511- ` 1.0.x ` Releases - [ 1.0.0] ( #100 )
612
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ public final class AuthenticationInterceptor<Authenticator: IAuthenticator>: IAu
4646 if credential. requiresRefresh {
4747 try await refresh ( credential, for: session)
4848 } else {
49- try await authenticator. apply ( credential, to: request)
49+ try await authenticator. apply ( credential, to: & request)
5050 }
5151 }
5252
Original file line number Diff line number Diff line change @@ -34,8 +34,8 @@ struct Authenticator: IAuthenticator {
3434 /// - Parameters:
3535 /// - credential: The `Credential`.
3636 /// - urlRequest: The `URLRequest`.
37- func apply (_ credential : Credential, to urlRequest : URLRequest) async throws {
38- request .addValue (" Bearer <token>" , forHTTPHeaderField : " Authorization" )
37+ func apply (_ credential : Credential, to urlRequest : inout URLRequest) async throws {
38+ urlRequest .addValue (" Bearer <token>" , forHTTPHeaderField : " Authorization" )
3939 }
4040
4141 /// Refreshes the `Credential`.
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ public protocol IAuthenticator {
1414 /// - Parameters:
1515 /// - credential: The `Credential`.
1616 /// - urlRequest: The `URLRequest`.
17- func apply( _ credential: Credential , to urlRequest: URLRequest ) async throws
17+ func apply( _ credential: Credential , to urlRequest: inout URLRequest ) async throws
1818
1919 /// Refreshes the `Credential`.
2020 ///
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ final class AuthenticatorMock: IAuthenticator {
1414 var invokedApplyParameters : ( credential: Credential , urlRequest: URLRequest ) ?
1515 var invokedApplyParametersList = [ ( credential: Credential, urlRequest: URLRequest) ] ( )
1616
17- func apply( _ credential: Credential , to urlRequest: URLRequest ) async throws {
17+ func apply( _ credential: Credential , to urlRequest: inout URLRequest ) async throws {
1818 invokedApply = true
1919 invokedApplyCount += 1
2020 invokedApplyParameters = ( credential, urlRequest)
Original file line number Diff line number Diff line change @@ -41,7 +41,8 @@ final class RequestParametersEncoderTests: XCTestCase {
4141
4242 func test_thatRequestParametersEncoderThrowsAnError_whenURLIsNotValid( ) {
4343 // given
44- var requestMock = URLRequest . fake ( string: . wrongURL)
44+ var requestMock = URLRequest . fake ( string: . domainName)
45+ requestMock. url = nil
4546
4647 // when
4748 var receivedError : NSError ?
@@ -60,7 +61,6 @@ final class RequestParametersEncoderTests: XCTestCase {
6061
6162private extension String {
6263 static let domainName = " https://google.com "
63- static let wrongURL = " http://example.com:-80 "
6464}
6565
6666private extension Dictionary where Self. Key == String , Self. Value == String {
You can’t perform that action at this time.
0 commit comments