DockerEngineAPI.RequestBuilder (testcontainers v1.13.4)
View SourceHelper functions for building Tesla requests
Summary
Functions
Add optional parameters to the request.
Add non-optional parameters to the request.
This function ensures that the body parameter is always set.
Evaluate and decode the response from a Tesla request.
Specify the request method when building a request.
Specify the request URL when building a request.
Types
@type response_mapping() :: [{status_code(), false | %{} | module()}]
@type status_code() :: :default | 100..599
Functions
Add optional parameters to the request.
Parameters
request(Map) - Collected request optionsdefinitions(Map) - Map of parameter name to parameter location.options(KeywordList) - The provided optional parameters
Returns
Map
Add non-optional parameters to the request.
Parameters
request(Map) - Collected request optionslocation(atom) - Where to put the parameterkey(atom) - The name of the parametervalue(any) - The value of the parameter
Returns
Map
This function ensures that the body parameter is always set.
When using Tesla with the httpc adapter (the default adapter), there is a
bug where POST, PATCH and PUT requests will fail if the body is empty.
Parameters
request(Map) - Collected request options
Returns
Map
@spec evaluate_response(Tesla.Env.result(), response_mapping()) :: {:ok, struct() | [struct()] | Tesla.Env.t()} | {:error, term()}
Evaluate and decode the response from a Tesla request.
result(Tesla.Env.result()): The Tesla response.mapping([{http_status, struct}]): Status-to-struct mapping for decoding.
Specify the request method when building a request.
Does not override the method if one has already been specified.
Parameters
request(Map) - Collected request optionsmethod(atom) - Request method
Returns
Map
Specify the request URL when building a request.
Does not override the url if one has already been specified.
Parameters
request(Map) - Collected request optionsurl(String) - Request URL
Returns
Map