@@ -194,7 +194,7 @@ public class HTTPClient {
194
194
/// - url: Remote URL.
195
195
/// - deadline: Point in time by which the request must complete.
196
196
public func get( url: String , deadline: NIODeadline ? = nil ) -> EventLoopFuture < Response > {
197
- return self . execute ( url : url , method : . GET , deadline: deadline)
197
+ return self . execute ( . GET , url : url , deadline: deadline)
198
198
}
199
199
200
200
/// Execute `POST` request using specified URL.
@@ -204,7 +204,7 @@ public class HTTPClient {
204
204
/// - body: Request body.
205
205
/// - deadline: Point in time by which the request must complete.
206
206
public func post( url: String , body: Body ? = nil , deadline: NIODeadline ? = nil ) -> EventLoopFuture < Response > {
207
- return self . execute ( url : url , method : . POST , body: body, deadline: deadline)
207
+ return self . execute ( . POST , url : url , body: body, deadline: deadline)
208
208
}
209
209
210
210
/// Execute `PATCH` request using specified URL.
@@ -214,7 +214,7 @@ public class HTTPClient {
214
214
/// - body: Request body.
215
215
/// - deadline: Point in time by which the request must complete.
216
216
public func patch( url: String , body: Body ? = nil , deadline: NIODeadline ? = nil ) -> EventLoopFuture < Response > {
217
- return self . execute ( url : url , method : . PATCH , body: body, deadline: deadline)
217
+ return self . execute ( . PATCH , url : url , body: body, deadline: deadline)
218
218
}
219
219
220
220
/// Execute `PUT` request using specified URL.
@@ -224,7 +224,7 @@ public class HTTPClient {
224
224
/// - body: Request body.
225
225
/// - deadline: Point in time by which the request must complete.
226
226
public func put( url: String , body: Body ? = nil , deadline: NIODeadline ? = nil ) -> EventLoopFuture < Response > {
227
- return self . execute ( url : url , method : . PUT , body: body, deadline: deadline)
227
+ return self . execute ( . PUT , url : url , body: body, deadline: deadline)
228
228
}
229
229
230
230
/// Execute `DELETE` request using specified URL.
@@ -233,17 +233,17 @@ public class HTTPClient {
233
233
/// - url: Remote URL.
234
234
/// - deadline: The time when the request must have been completed by.
235
235
public func delete( url: String , deadline: NIODeadline ? = nil ) -> EventLoopFuture < Response > {
236
- return self . execute ( url : url , method : . DELETE , deadline: deadline)
236
+ return self . execute ( . DELETE , url : url , deadline: deadline)
237
237
}
238
238
239
239
/// Execute arbitrary HTTP request using specified URL.
240
240
///
241
241
/// - parameters:
242
- /// - url: Request url.
243
242
/// - method: Request method.
243
+ /// - url: Request url.
244
244
/// - body: Request body.
245
245
/// - deadline: Point in time by which the request must complete.
246
- public func execute( url : String , method : HTTPMethod , body: Body ? = nil , deadline: NIODeadline ? = nil ) -> EventLoopFuture < Response > {
246
+ public func execute( _ method : HTTPMethod = . GET , url : String , body: Body ? = nil , deadline: NIODeadline ? = nil ) -> EventLoopFuture < Response > {
247
247
do {
248
248
let request = try Request ( url: url, method: method, body: body)
249
249
return self . execute ( request: request, deadline: deadline)
@@ -255,14 +255,14 @@ public class HTTPClient {
255
255
/// Execute arbitrary HTTP+UNIX request to a unix domain socket path, using the specified URL as the request to send to the server.
256
256
///
257
257
/// - parameters:
258
- /// - socketPath: The path to the unix domain socket to connect to.
259
- /// - url: The URL path and query that will be sent to the server.
260
258
/// - method: Request method.
259
+ /// - socketPath: The path to the unix domain socket to connect to.
260
+ /// - urlPath: The URL path and query that will be sent to the server.
261
261
/// - body: Request body.
262
262
/// - deadline: Point in time by which the request must complete.
263
- public func execute( socketPath : String , url : String , method : HTTPMethod , body: Body ? = nil , deadline: NIODeadline ? = nil ) -> EventLoopFuture < Response > {
263
+ public func execute( _ method : HTTPMethod = . GET , socketPath : String , urlPath : String , body: Body ? = nil , deadline: NIODeadline ? = nil ) -> EventLoopFuture < Response > {
264
264
do {
265
- guard let url = URL ( httpURLWithSocketPath: socketPath, uri: url ) else {
265
+ guard let url = URL ( httpURLWithSocketPath: socketPath, uri: urlPath ) else {
266
266
throw HTTPClientError . invalidURL
267
267
}
268
268
let request = try Request ( url: url, method: method, body: body)
@@ -275,14 +275,14 @@ public class HTTPClient {
275
275
/// Execute arbitrary HTTPS+UNIX request to a unix domain socket path over TLS, using the specified URL as the request to send to the server.
276
276
///
277
277
/// - parameters:
278
- /// - secureSocketPath: The path to the unix domain socket to connect to.
279
- /// - url: The URL path and query that will be sent to the server.
280
278
/// - method: Request method.
279
+ /// - secureSocketPath: The path to the unix domain socket to connect to.
280
+ /// - urlPath: The URL path and query that will be sent to the server.
281
281
/// - body: Request body.
282
282
/// - deadline: Point in time by which the request must complete.
283
- public func execute( secureSocketPath : String , url : String , method : HTTPMethod , body: Body ? = nil , deadline: NIODeadline ? = nil ) -> EventLoopFuture < Response > {
283
+ public func execute( _ method : HTTPMethod = . GET , secureSocketPath : String , urlPath : String , body: Body ? = nil , deadline: NIODeadline ? = nil ) -> EventLoopFuture < Response > {
284
284
do {
285
- guard let url = URL ( httpsURLWithSocketPath: secureSocketPath, uri: url ) else {
285
+ guard let url = URL ( httpsURLWithSocketPath: secureSocketPath, uri: urlPath ) else {
286
286
throw HTTPClientError . invalidURL
287
287
}
288
288
let request = try Request ( url: url, method: method, body: body)
0 commit comments