Skip to content

Commit

Permalink
Merge pull request #26 from Adyen/make-request-headers-settable
Browse files Browse the repository at this point in the history
Make headers property settable
  • Loading branch information
nauaros authored Mar 28, 2023
2 parents 34ad72e + 1c5dd70 commit 47bdc97
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion AdyenNetworking/APIClient/Request.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public protocol Request: Encodable {

/// :nodoc:
/// The HTTP headers.
var headers: [String: String] { get }
var headers: [String: String] { get set }

/// :nodoc:
/// The query parameters.
Expand Down
2 changes: 1 addition & 1 deletion Networking Demo App/API/Requests/CreateUsersRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ internal struct CreateUsersRequest: Request {

var counter: UInt = 0

let headers: [String : String] = [:]
var headers: [String : String] = [:]

func encode(to encoder: Encoder) throws {
var container = encoder.singleValueContainer()
Expand Down
2 changes: 1 addition & 1 deletion Networking Demo App/API/Requests/GetUsersRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ internal struct GetUsersRequest: Request {

var counter: UInt = 0

let headers: [String : String] = [:]
var headers: [String : String] = [:]

private enum CodingKeys: CodingKey {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ internal struct InvalidCreateUsersRequest: Request {

var counter: UInt = 0

let headers: [String : String] = [:]
var headers: [String : String] = [:]

private enum CodingKeys: CodingKey {}
}
4 changes: 2 additions & 2 deletions Networking Demo AppTests/APIClientTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,10 @@ enum ValidationError: Error {
}

public class MockResponseValidator: AnyResponseValidator {

var onValidated: (() throws -> Void)?

public func validate<R>(_ responseData: Data, for request: R, with responseHeaders: [AnyHashable : Any]) throws {
public func validate<R>(_ responseData: Data, for request: R, with responseHeaders: [String : String]) throws {
try onValidated?()
}
}
Expand Down

0 comments on commit 47bdc97

Please sign in to comment.