@@ -34,14 +34,13 @@ type Proxy = {
34
34
credentials: System .Net .ICredentials option
35
35
}
36
36
37
- type HttpClientHandlerTransformer = ( System.Net.Http.SocketsHttpHandler -> System.Net.Http.SocketsHttpHandler)
38
-
39
- and Config = {
37
+ type Config = {
40
38
timeout: System .TimeSpan option
41
39
defaultDecompressionMethods: System .Net .DecompressionMethods list
42
40
printHint: PrintHint
41
+ headerTransformers: list < Header -> Header >
43
42
httpMessageTransformers: list < System .Net .Http .HttpRequestMessage -> System .Net .Http .HttpRequestMessage >
44
- httpClientHandlerTransformers: list < HttpClientHandlerTransformer >
43
+ httpClientHandlerTransformers: list < System . Net . Http . SocketsHttpHandler -> System . Net . Http . SocketsHttpHandler >
45
44
httpClientTransformers: list < System .Net .Http .HttpClient -> System .Net .Http .HttpClient >
46
45
httpCompletionOption: System .Net .Http .HttpCompletionOption
47
46
proxy: Proxy option
@@ -52,46 +51,30 @@ and Config = {
52
51
cancellationToken: CancellationToken
53
52
}
54
53
55
- type ConfigTransformer = Config -> Config
54
+ and ConfigTransformer = Config -> Config
56
55
57
- type PrintHintTransformer = PrintHint -> PrintHint
56
+ and PrintHintTransformer = PrintHint -> PrintHint
58
57
59
- type FsHttpUrl = {
58
+ and FsHttpTarget = {
59
+ method: System .Net .Http .HttpMethod option
60
60
address: string option
61
- additionalQueryParams: List < string * string >
61
+ additionalQueryParams: list < string * string >
62
62
}
63
63
64
- type Header = {
65
- method : System . Net . Http . HttpMethod option
64
+ and Header = {
65
+ target : FsHttpTarget
66
66
headers: Map < string , string >
67
67
// We use a .Net type here, which we never do in other places.
68
68
// Since Cookie is record style, I see no problem here.
69
69
cookies: System .Net .Cookie list
70
70
}
71
71
72
- type ContentData =
73
- | TextContent of string
74
- | BinaryContent of byte array
75
- | StreamContent of System.IO.Stream
76
- | FormUrlEncodedContent of Map < string , string >
77
- | FileContent of string
78
-
79
- type ContentType = {
80
- value: string
81
- charset: System .Text .Encoding option
82
- }
83
-
84
- type ContentElement = {
85
- contentData: ContentData
86
- explicitContentType: ContentType option
87
- }
88
-
89
- type RequestContent =
72
+ type BodyContent =
90
73
| Empty
91
- | Single of BodyContent
74
+ | Single of SinglepartContent
92
75
| Multi of MultipartContent
93
76
94
- and BodyContent = {
77
+ and SinglepartContent = {
95
78
contentElement: ContentElement
96
79
headers: Map < string , string >
97
80
}
@@ -107,10 +90,26 @@ and MultipartElement = {
107
90
fileName: string option
108
91
}
109
92
93
+ and ContentData =
94
+ | TextContent of string
95
+ | BinaryContent of byte array
96
+ | StreamContent of System.IO.Stream
97
+ | FormUrlEncodedContent of Map < string , string >
98
+ | FileContent of string
99
+
100
+ and ContentType = {
101
+ value: string
102
+ charset: System .Text .Encoding option
103
+ }
104
+
105
+ and ContentElement = {
106
+ contentData: ContentData
107
+ explicitContentType: ContentType option
108
+ }
109
+
110
110
type Request = {
111
- url: FsHttpUrl
112
111
header: Header
113
- content: RequestContent
112
+ content: BodyContent
114
113
config: Config
115
114
}
116
115
@@ -140,7 +139,6 @@ and IToMultipartContext =
140
139
141
140
// TODO: Convert this to a class.
142
141
and HeaderContext = {
143
- url: FsHttpUrl
144
142
header: Header
145
143
config: Config
146
144
} with
@@ -155,15 +153,13 @@ and HeaderContext = {
155
153
156
154
interface IToRequest with
157
155
member this.Transform () = {
158
- url = this.url
159
156
header = this.header
160
157
content = Empty
161
158
config = this.config
162
159
}
163
160
164
161
interface IToBodyContext with
165
162
member this.Transform () = {
166
- url = this.url
167
163
header = this.header
168
164
bodyContent = {
169
165
contentElement = {
@@ -177,7 +173,6 @@ and HeaderContext = {
177
173
178
174
interface IToMultipartContext with
179
175
member this.Transform () = {
180
- url = this.url
181
176
header = this.header
182
177
config = this.config
183
178
multipartContent = {
@@ -188,9 +183,8 @@ and HeaderContext = {
188
183
189
184
// TODO: Convert this to a class.
190
185
and BodyContext = {
191
- url: FsHttpUrl
192
186
header: Header
193
- bodyContent: BodyContent
187
+ bodyContent: SinglepartContent
194
188
config: Config
195
189
} with
196
190
interface IRequestContext< BodyContext> with
@@ -204,7 +198,6 @@ and BodyContext = {
204
198
205
199
interface IToRequest with
206
200
member this.Transform () = {
207
- url = this.url
208
201
header = this.header
209
202
content = Single this.bodyContent
210
203
config = this.config
@@ -215,7 +208,6 @@ and BodyContext = {
215
208
216
209
// TODO: Convert this to a class.
217
210
and MultipartContext = {
218
- url: FsHttpUrl
219
211
header: Header
220
212
multipartContent: MultipartContent
221
213
config: Config
@@ -231,7 +223,6 @@ and MultipartContext = {
231
223
232
224
interface IToRequest with
233
225
member this.Transform () = {
234
- url = this.url
235
226
header = this.header
236
227
content = Multi this.multipartContent
237
228
config = this.config
0 commit comments