Skip to content
This repository was archived by the owner on Nov 24, 2024. It is now read-only.

Commit e1393d0

Browse files
committed
Fix missing Host header for Docker requests
1 parent 1bff060 commit e1393d0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/DockerClientSwift/APIs/DockerClient.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class DockerClient {
3333
/// - Returns: Returns an `EventLoopFuture` of the expected result definied by the `Endpoint`.
3434
internal func run<T: Endpoint>(_ endpoint: T) throws -> EventLoopFuture<T.Response> {
3535
logger.info("Execute Endpoint: \(endpoint.path)")
36-
return client.execute(endpoint.method, socketPath: daemonSocket, urlPath: "/v1.40/\(endpoint.path)", body: endpoint.body.map {HTTPClient.Body.data( try! $0.encode())}, logger: logger, headers: HTTPHeaders([("Content-Type", "application/json")]))
36+
return client.execute(endpoint.method, socketPath: daemonSocket, urlPath: "/v1.40/\(endpoint.path)", body: endpoint.body.map {HTTPClient.Body.data( try! $0.encode())}, logger: logger, headers: HTTPHeaders([("Content-Type", "application/json"), ("Host", "localhost")]))
3737
.logResponseBody(logger)
3838
.decode(as: T.Response.self)
3939
}
@@ -44,7 +44,7 @@ public class DockerClient {
4444
/// - Returns: Returns an `EventLoopFuture` of the expected result definied and transformed by the `PipelineEndpoint`.
4545
internal func run<T: PipelineEndpoint>(_ endpoint: T) throws -> EventLoopFuture<T.Response> {
4646
logger.info("Execute PipelineEndpoint: \(endpoint.path)")
47-
return client.execute(endpoint.method, socketPath: daemonSocket, urlPath: "/v1.40/\(endpoint.path)", body: endpoint.body.map {HTTPClient.Body.data( try! $0.encode())}, logger: logger, headers: HTTPHeaders([("Content-Type", "application/json")]))
47+
return client.execute(endpoint.method, socketPath: daemonSocket, urlPath: "/v1.40/\(endpoint.path)", body: endpoint.body.map {HTTPClient.Body.data( try! $0.encode())}, logger: logger, headers: HTTPHeaders([("Content-Type", "application/json"), ("Host", "localhost")]))
4848
.logResponseBody(logger)
4949
.mapString(map: endpoint.map(data: ))
5050
}

0 commit comments

Comments
 (0)