@@ -17,14 +17,14 @@ import NIOCore
17
17
import NIOHTTP1
18
18
19
19
@available ( macOS 10 . 15 , iOS 13 . 0 , watchOS 6 . 0 , tvOS 13 . 0 , * )
20
- struct HTTPClientRequest {
21
- var url : String
22
- var method : HTTPMethod
23
- var headers : HTTPHeaders
20
+ public struct HTTPClientRequest {
21
+ public var url : String
22
+ public var method : HTTPMethod
23
+ public var headers : HTTPHeaders
24
24
25
- var body : Body ?
25
+ public var body : Body ?
26
26
27
- init ( url: String ) {
27
+ public init ( url: String ) {
28
28
self . url = url
29
29
self . method = . GET
30
30
self . headers = . init( )
@@ -34,29 +34,32 @@ struct HTTPClientRequest {
34
34
35
35
@available ( macOS 10 . 15 , iOS 13 . 0 , watchOS 6 . 0 , tvOS 13 . 0 , * )
36
36
extension HTTPClientRequest {
37
- struct Body {
37
+ public struct Body {
38
+ @usableFromInline
38
39
internal enum Mode {
39
40
case asyncSequence( length: Int ? , ( ByteBufferAllocator ) async throws -> ByteBuffer ? )
40
41
case sequence( length: Int ? , canBeConsumedMultipleTimes: Bool , ( ByteBufferAllocator ) -> ByteBuffer )
41
42
case byteBuffer( ByteBuffer )
42
43
}
43
44
44
- var mode : Mode
45
+ @usableFromInline
46
+ internal var mode : Mode
45
47
46
- private init ( _ mode: Mode ) {
48
+ @inlinable
49
+ internal init ( _ mode: Mode ) {
47
50
self . mode = mode
48
51
}
49
52
}
50
53
}
51
54
52
55
@available ( macOS 10 . 15 , iOS 13 . 0 , watchOS 6 . 0 , tvOS 13 . 0 , * )
53
56
extension HTTPClientRequest . Body {
54
- static func byteBuffer( _ byteBuffer: ByteBuffer ) -> Self {
57
+ public static func byteBuffer( _ byteBuffer: ByteBuffer ) -> Self {
55
58
self . init ( . byteBuffer( byteBuffer) )
56
59
}
57
60
58
61
@inlinable
59
- static func bytes< Bytes: Sequence > (
62
+ public static func bytes< Bytes: Sequence > (
60
63
length: Int ? ,
61
64
_ bytes: Bytes
62
65
) -> Self where Bytes. Element == UInt8 {
@@ -71,7 +74,7 @@ extension HTTPClientRequest.Body {
71
74
}
72
75
73
76
@inlinable
74
- static func bytes< Bytes: Collection > (
77
+ public static func bytes< Bytes: Collection > (
75
78
length: Int ? ,
76
79
_ bytes: Bytes
77
80
) -> Self where Bytes. Element == UInt8 {
@@ -86,7 +89,7 @@ extension HTTPClientRequest.Body {
86
89
}
87
90
88
91
@inlinable
89
- static func bytes< Bytes: RandomAccessCollection > (
92
+ public static func bytes< Bytes: RandomAccessCollection > (
90
93
_ bytes: Bytes
91
94
) -> Self where Bytes. Element == UInt8 {
92
95
self . init ( . sequence( length: bytes. count, canBeConsumedMultipleTimes: true ) { allocator in
@@ -100,7 +103,7 @@ extension HTTPClientRequest.Body {
100
103
}
101
104
102
105
@inlinable
103
- static func stream< SequenceOfBytes: AsyncSequence > (
106
+ public static func stream< SequenceOfBytes: AsyncSequence > (
104
107
length: Int ? ,
105
108
_ sequenceOfBytes: SequenceOfBytes
106
109
) -> Self where SequenceOfBytes. Element == ByteBuffer {
@@ -112,7 +115,7 @@ extension HTTPClientRequest.Body {
112
115
}
113
116
114
117
@inlinable
115
- static func stream< Bytes: AsyncSequence > (
118
+ public static func stream< Bytes: AsyncSequence > (
116
119
length: Int ? ,
117
120
_ bytes: Bytes
118
121
) -> Self where Bytes. Element == UInt8 {
0 commit comments