mirror of
https://github.com/apple/swift-http-types
synced 2026-11-25 04:47:48 +00:00
Merge pull request #41 from MaxDesiatov/maxd/fix-wasi-builds
Fix package not building for WASI
This commit is contained in:
4 files changed
+15
-1
No files matched your search
@@ -14,8 +14,10 @@
|
||||
|
||||
#if canImport(os.lock)
|
||||
import os.lock
|
||||
#else
|
||||
#elseif canImport(Glibc)
|
||||
import Glibc
|
||||
#elseif canImport(WASILibc)
|
||||
import WASILibc
|
||||
#endif
|
||||
|
||||
/// A collection of HTTP fields. It is used in `HTTPRequest` and `HTTPResponse`, and can also be
|
||||
|
||||
@@ -18,6 +18,8 @@ import HTTPTypes
|
||||
import FoundationNetworking
|
||||
#endif
|
||||
|
||||
#if !os(WASI)
|
||||
|
||||
extension URLRequest {
|
||||
/// Create a `URLRequest` from an `HTTPRequest`.
|
||||
/// - Parameter httpRequest: The HTTP request to convert from.
|
||||
@@ -63,3 +65,5 @@ extension URLRequest {
|
||||
return request
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -18,6 +18,8 @@ import HTTPTypes
|
||||
import FoundationNetworking
|
||||
#endif
|
||||
|
||||
#if !os(WASI)
|
||||
|
||||
extension HTTPURLResponse {
|
||||
/// Create an `HTTPURLResponse` from an `HTTPResponse`.
|
||||
/// - Parameter httpResponse: The HTTP response to convert from.
|
||||
@@ -55,3 +57,5 @@ extension HTTPURLResponse {
|
||||
return response
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -18,6 +18,8 @@ import HTTPTypes
|
||||
import FoundationNetworking
|
||||
#endif
|
||||
|
||||
#if !os(WASI)
|
||||
|
||||
extension URLSessionTask {
|
||||
/// The original HTTP request this task was created with.
|
||||
public var originalHTTPRequest: HTTPRequest? {
|
||||
@@ -40,6 +42,8 @@ private enum HTTPTypeConversionError: Error {
|
||||
case failedToConvertURLResponseToHTTPResponse
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(visionOS)
|
||||
|
||||
@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
|
||||
|
||||
Reference in new issue
Block a user