Skip to content

Commit

Permalink
Remove recordedAt from interactions
Browse files Browse the repository at this point in the history
… because who cares?
  • Loading branch information
cysp committed Apr 19, 2020
1 parent 1c0106b commit 64c864f
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions Sources/DVR/Interaction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,14 @@ struct Interaction {
let request: URLRequest
let response: Foundation.URLResponse
let responseData: Data?
let recordedAt: Date


// MARK: - Initializers

init(request: URLRequest, response: Foundation.URLResponse, responseData: Data? = nil, recordedAt: Date = Date()) {
init(request: URLRequest, response: Foundation.URLResponse, responseData: Data? = nil) {
self.request = request
self.response = response
self.responseData = responseData
self.recordedAt = recordedAt
}


Expand Down Expand Up @@ -78,7 +76,6 @@ extension Interaction {
var dictionary: [String: Any] {
var dictionary: [String: Any] = [
"request": request.dictionary,
"recorded_at": recordedAt.timeIntervalSince1970
]

var responseDictionary = self.response.dictionary
Expand All @@ -99,12 +96,10 @@ extension Interaction {

init?(dictionary: [String: Any]) {
guard let request = dictionary["request"] as? [String: Any],
let response = dictionary["response"] as? [String: Any],
let recordedAt = dictionary["recorded_at"] as? TimeInterval else { return nil }
let response = dictionary["response"] as? [String: Any] else { return nil }

self.request = NSMutableURLRequest(dictionary: request) as URLRequest
self.response = HTTPURLResponse(dictionary: response)
self.recordedAt = Date(timeIntervalSince1970: recordedAt)
self.responseData = Interaction.dencodeBody(response["body"], headers: response["headers"] as? [String: String])
}
}

0 comments on commit 64c864f

Please sign in to comment.