Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
nolanw committed Jun 19, 2024
1 parent 7075059 commit 7f1cd4c
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions AwfulCore/Sources/AwfulCore/Networking/ForumsClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,19 @@ public final class ForumsClient {
}

private var loginCookie: HTTPCookie? {
return baseURL
baseURL
.flatMap { urlSession?.configuration.httpCookieStorage?.cookies(for: $0) }?
.first { $0.name == "bbuserid" }
}

/// Whether or not a valid, logged-in session exists.
public var isLoggedIn: Bool {
return loginCookie != nil
loginCookie != nil
}

/// When the valid, logged-in session expires.
public var loginCookieExpiryDate: Date? {
return loginCookie?.expiresDate
loginCookie?.expiresDate
}

enum Error: Swift.Error {
Expand Down Expand Up @@ -1271,10 +1271,7 @@ extension URLSessionTask: Cancellable {}
private typealias ParsedDocument = (document: HTMLDocument, url: URL?)

private func parseHTML(data: Data, response: URLResponse) throws -> ParsedDocument {
let contentType: String? = {
guard let response = response as? HTTPURLResponse else { return nil }
return response.allHeaderFields["Content-Type"] as? String
}()
let contentType = (response as? HTTPURLResponse)?.allHeaderFields["Content-Type"] as? String
let document = HTMLDocument(data: data, contentTypeHeader: contentType)
try checkServerErrors(document)
return (document: document, url: response.url)
Expand Down

0 comments on commit 7f1cd4c

Please sign in to comment.