Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix package not building for WASI #41

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion Sources/HTTPTypes/HTTPFields.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions Sources/HTTPTypesFoundation/URLRequest+HTTPTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -63,3 +65,5 @@ extension URLRequest {
return request
}
}

#endif
4 changes: 4 additions & 0 deletions Sources/HTTPTypesFoundation/URLResponse+HTTPTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -55,3 +57,5 @@ extension HTTPURLResponse {
return response
}
}

#endif
4 changes: 4 additions & 0 deletions Sources/HTTPTypesFoundation/URLSession+HTTPTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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? {
Expand All @@ -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, *)
Expand Down