Skip to content

Commit

Permalink
[ios] sync date from http response when fetch experiments
Browse files Browse the repository at this point in the history
  • Loading branch information
RyosukeCla committed Nov 21, 2024
1 parent 53babf6 commit fbaaeaf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ios/Nativebrik/Nativebrik/data/experiment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ class ExperimentRepositoryImpl: ExperimentRepository2 {
var request = URLRequest(url: url)
request.httpMethod = "GET"
do {
let t0 = getCurrentDate()
let (data, response) = try await nativebrikSession.data(for: request)
guard let res = response as? HTTPURLResponse else {
return Result.failure(NativebrikError.irregular("Failed to parse as HttpURLResponse"))
}
syncDateFromHTTPURLResponse(t0: t0, res: res)
if res.statusCode == 404 {
return Result.failure(NativebrikError.notFound)
}
Expand All @@ -49,10 +51,12 @@ class ExperimentRepositoryImpl: ExperimentRepository2 {
var request = URLRequest(url: url)
request.httpMethod = "GET"
do {
let t0 = getCurrentDate()
let (data, response) = try await nativebrikSession.data(for: request)
guard let res = response as? HTTPURLResponse else {
return Result.failure(NativebrikError.irregular("Failed to parse as HttpURLResponse"))
}
syncDateFromHTTPURLResponse(t0: t0, res: res)
if res.statusCode == 404 {
return Result.failure(NativebrikError.notFound)
}
Expand Down

0 comments on commit fbaaeaf

Please sign in to comment.