Skip to content

Commit

Permalink
Allow decoding strategy to be passed in
Browse files Browse the repository at this point in the history
  • Loading branch information
msencenb committed Dec 12, 2023
1 parent a0f1b30 commit 5893acd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Sources/JOConnor/APIRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public struct APIRequest<T: Codable> {
let postData: PostData?
let user: Authable?

public init(absolutePath: String, verb: APIRequestVerb, postData: PostData?, user: Authable?) {
decoder.dateDecodingStrategy = .iso8601
public init(absolutePath: String, verb: APIRequestVerb, postData: PostData?, user: Authable?, decodingStrategy: JSONDecoder.DateDecodingStrategy?) {
decoder.dateDecodingStrategy = decodingStrategy ?? .iso8601

self.absolutePath = absolutePath
self.verb = verb
Expand Down
2 changes: 1 addition & 1 deletion Tests/JOConnorTests/JOConnorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ final class JOConnorTests: XCTestCase {
}

func testInitializeApiRequest() {
let request = APIRequest<MockDecodable>.init(absolutePath: "https://localhost:3000", verb: APIRequestVerb.get, postData: nil, user: nil);
let request = APIRequest<MockDecodable>.init(absolutePath: "https://localhost:3000", verb: APIRequestVerb.get, postData: nil, user: nil, decodingStrategy: nil);
XCTAssertNotNil(request)
}

Expand Down

0 comments on commit 5893acd

Please sign in to comment.