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

Commit

Permalink
Fix missing Host header for Docker requests
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsteinerde committed May 7, 2022
1 parent 1bff060 commit e1393d0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/DockerClientSwift/APIs/DockerClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class DockerClient {
/// - Returns: Returns an `EventLoopFuture` of the expected result definied by the `Endpoint`.
internal func run<T: Endpoint>(_ endpoint: T) throws -> EventLoopFuture<T.Response> {
logger.info("Execute Endpoint: \(endpoint.path)")
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")]))
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")]))
.logResponseBody(logger)
.decode(as: T.Response.self)
}
Expand All @@ -44,7 +44,7 @@ public class DockerClient {
/// - Returns: Returns an `EventLoopFuture` of the expected result definied and transformed by the `PipelineEndpoint`.
internal func run<T: PipelineEndpoint>(_ endpoint: T) throws -> EventLoopFuture<T.Response> {
logger.info("Execute PipelineEndpoint: \(endpoint.path)")
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")]))
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")]))
.logResponseBody(logger)
.mapString(map: endpoint.map(data: ))
}
Expand Down

0 comments on commit e1393d0

Please sign in to comment.