Skip to content

Commit

Permalink
delete file function
Browse files Browse the repository at this point in the history
  • Loading branch information
zunda-pixel committed Nov 30, 2024
1 parent a88653a commit bc4cf49
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions Sources/Helpers/HTTP/URLSession+HTTPRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,27 +54,6 @@ extension URLSession {
return (data, response)
}

/// Convenience method to upload data using an `HTTPRequest`; creates and resumes a `URLSessionUploadTask` internally.
///
/// - Parameter request: The `HTTPRequest` for which to upload data.
/// - Parameter fileURL: File to upload.
/// - Parameter delegate: Task-specific delegate.
/// - Returns: Data and response.
public func upload(
for request: HTTPRequest,
fromFile fileURL: URL,
delegate: (any URLSessionTaskDelegate)? = nil
) async throws -> (Data, HTTPResponse) {
guard let urlRequest = URLRequest(httpRequest: request) else {
throw HTTPTypeConversionError.failedToConvertHTTPRequestToURLRequest
}
let (data, urlResponse) = try await self.upload(for: urlRequest, fromFile: fileURL, delegate: delegate)
guard let response = (urlResponse as? HTTPURLResponse)?.httpResponse else {
throw HTTPTypeConversionError.failedToConvertURLResponseToHTTPResponse
}
return (data, response)
}

/// Convenience method to upload data using an `HTTPRequest`, creates and resumes a `URLSessionUploadTask` internally.
///
/// - Parameter request: The `HTTPRequest` for which to upload data.
Expand Down Expand Up @@ -154,22 +133,6 @@ extension URLSession {
return (data, response)
}

/// Convenience method to upload data using an `HTTPRequest`; creates and resumes a `URLSessionUploadTask` internally.
///
/// - Parameter request: The `HTTPRequest` for which to upload data.
/// - Parameter fileURL: File to upload.
/// - Returns: Data and response.
public func upload(for request: HTTPRequest, fromFile fileURL: URL) async throws -> (Data, HTTPResponse) {
guard let urlRequest = URLRequest(httpRequest: request) else {
throw HTTPTypeConversionError.failedToConvertHTTPRequestToURLRequest
}
let (data, urlResponse) = try await self.upload(for: urlRequest, fromFile: fileURL)
guard let response = (urlResponse as? HTTPURLResponse)?.httpResponse else {
throw HTTPTypeConversionError.failedToConvertURLResponseToHTTPResponse
}
return (data, response)
}

/// Convenience method to upload data using an `HTTPRequest`, creates and resumes a `URLSessionUploadTask` internally.
///
/// - Parameter request: The `HTTPRequest` for which to upload data.
Expand Down

0 comments on commit bc4cf49

Please sign in to comment.