diff --git a/Sources/HTTPTypes/HTTPFields.swift b/Sources/HTTPTypes/HTTPFields.swift index e2f8d2d..ffda625 100644 --- a/Sources/HTTPTypes/HTTPFields.swift +++ b/Sources/HTTPTypes/HTTPFields.swift @@ -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 diff --git a/Sources/HTTPTypesFoundation/URLRequest+HTTPTypes.swift b/Sources/HTTPTypesFoundation/URLRequest+HTTPTypes.swift index 05d781d..20152d4 100644 --- a/Sources/HTTPTypesFoundation/URLRequest+HTTPTypes.swift +++ b/Sources/HTTPTypesFoundation/URLRequest+HTTPTypes.swift @@ -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 diff --git a/Sources/HTTPTypesFoundation/URLResponse+HTTPTypes.swift b/Sources/HTTPTypesFoundation/URLResponse+HTTPTypes.swift index d605ca6..dfcc839 100644 --- a/Sources/HTTPTypesFoundation/URLResponse+HTTPTypes.swift +++ b/Sources/HTTPTypesFoundation/URLResponse+HTTPTypes.swift @@ -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 diff --git a/Sources/HTTPTypesFoundation/URLSession+HTTPTypes.swift b/Sources/HTTPTypesFoundation/URLSession+HTTPTypes.swift index 0f9e6fb..16e4e3e 100644 --- a/Sources/HTTPTypesFoundation/URLSession+HTTPTypes.swift +++ b/Sources/HTTPTypesFoundation/URLSession+HTTPTypes.swift @@ -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, *)