@@ -6,13 +6,10 @@ defmodule Testcontainers.Docker.Api do
66
77 alias DockerEngineAPI.Api
88 alias Testcontainers.Container
9- alias Testcontainers.Constants
109
1110 def get_container ( container_id , conn )
1211 when is_binary ( container_id ) do
13- case Api.Container . container_inspect ( conn , container_id ,
14- "User-Agent": Constants . user_agent ( )
15- ) do
12+ case Api.Container . container_inspect ( conn , container_id ) do
1613 { :error , % Tesla.Env { status: other } } ->
1714 { :error , { :http_error , other } }
1815
@@ -29,8 +26,7 @@ defmodule Testcontainers.Docker.Api do
2926
3027 case Api.Image . image_create ( conn ,
3128 fromImage: image ,
32- "X-Registry-Auth": auth ,
33- "User-Agent": Constants . user_agent ( )
29+ "X-Registry-Auth": auth
3430 ) do
3531 { :ok , % Tesla.Env { status: 200 } } ->
3632 { :ok , nil }
@@ -44,9 +40,7 @@ defmodule Testcontainers.Docker.Api do
4440 end
4541
4642 def create_container ( % Container { } = container , conn ) do
47- case Api.Container . container_create ( conn , container_create_request ( container ) ,
48- "User-Agent": Constants . user_agent ( )
49- ) do
43+ case Api.Container . container_create ( conn , container_create_request ( container ) ) do
5044 { :error , % Tesla.Env { status: other } } ->
5145 { :error , { :http_error , other } }
5246
@@ -59,9 +53,7 @@ defmodule Testcontainers.Docker.Api do
5953 end
6054
6155 def start_container ( id , conn ) when is_binary ( id ) do
62- case Api.Container . container_start ( conn , id ,
63- "User-Agent": Constants . user_agent ( )
64- ) do
56+ case Api.Container . container_start ( conn , id ) do
6557 { :ok , % Tesla.Env { status: 204 } } ->
6658 :ok
6759
@@ -75,22 +67,16 @@ defmodule Testcontainers.Docker.Api do
7567
7668 def stop_container ( container_id , conn ) when is_binary ( container_id ) do
7769 with { :ok , _ } <-
78- Api.Container . container_kill ( conn , container_id ,
79- "User-Agent": Constants . user_agent ( )
80- ) ,
70+ Api.Container . container_kill ( conn , container_id ) ,
8171 { :ok , _ } <-
82- Api.Container . container_delete ( conn , container_id ,
83- "User-Agent": Constants . user_agent ( )
84- ) do
72+ Api.Container . container_delete ( conn , container_id ) do
8573 :ok
8674 end
8775 end
8876
8977 def put_file ( container_id , connection , path , file_name , file_contents ) do
9078 with { :ok , tar_file_contents } <- create_tar_stream ( file_name , file_contents ) do
91- Api.Container . put_container_archive ( connection , container_id , path , tar_file_contents ,
92- "User-Agent": Constants . user_agent ( )
93- )
79+ Api.Container . put_container_archive ( connection , container_id , path , tar_file_contents )
9480 end
9581 end
9682
@@ -113,7 +99,7 @@ defmodule Testcontainers.Docker.Api do
11399 end
114100
115101 def inspect_exec ( exec_id , conn ) do
116- case Api.Exec . exec_inspect ( conn , exec_id , "User-Agent": Constants . user_agent ( ) ) do
102+ case Api.Exec . exec_inspect ( conn , exec_id ) do
117103 { :ok , % DockerEngineAPI.Model.ExecInspectResponse { } = body } ->
118104 { :ok , parse_inspect_result ( body ) }
119105
@@ -140,8 +126,7 @@ defmodule Testcontainers.Docker.Api do
140126 conn ,
141127 container_id ,
142128 stdout: true ,
143- stderr: true ,
144- "User-Agent": Constants . user_agent ( )
129+ stderr: true
145130 ) do
146131 { :ok , % Tesla.Env { body: body } } ->
147132 { :ok , body }
@@ -155,9 +140,7 @@ defmodule Testcontainers.Docker.Api do
155140 end
156141
157142 def get_bridge_gateway ( conn ) do
158- case Api.Network . network_inspect ( conn , "bridge" ,
159- "User-Agent": Constants . user_agent ( )
160- ) do
143+ case Api.Network . network_inspect ( conn , "bridge" ) do
161144 { :ok , % DockerEngineAPI.Model.Network { IPAM: % DockerEngineAPI.Model.Ipam { Config: config } } } ->
162145 with_gateway =
163146 config
@@ -271,9 +254,7 @@ defmodule Testcontainers.Docker.Api do
271254 defp create_exec ( container_id , command , conn ) do
272255 data = % { "Cmd" => command }
273256
274- case Api.Exec . container_exec ( conn , container_id , data ,
275- "User-Agent": Constants . user_agent ( )
276- ) do
257+ case Api.Exec . container_exec ( conn , container_id , data ) do
277258 { :ok , % DockerEngineAPI.Model.IdResponse { Id: id } } ->
278259 { :ok , id }
279260
@@ -289,10 +270,7 @@ defmodule Testcontainers.Docker.Api do
289270 end
290271
291272 defp start_exec ( exec_id , conn ) do
292- case Api.Exec . exec_start ( conn , exec_id ,
293- body: % { } ,
294- "User-Agent": Constants . user_agent ( )
295- ) do
273+ case Api.Exec . exec_start ( conn , exec_id , body: % { } ) do
296274 { :ok , % Tesla.Env { status: 200 } } ->
297275 :ok
298276
0 commit comments