Tinkex.API.Request (Tinkex v0.3.4)
View SourceRequest preparation and body encoding for Tinkex API.
Handles:
- JSON body encoding
- Multipart/form-data encoding for file uploads
- Request body preparation and validation
- Content-type header management
Summary
Functions
Formats error reasons from request preparation into human-readable messages.
Prepares the request body and updates headers as needed.
Functions
Formats error reasons from request preparation into human-readable messages.
@spec prepare_body(term(), [{String.t(), String.t()}], term(), keyword()) :: {:ok, [{String.t(), String.t()}], iodata()} | {:error, term()}
Prepares the request body and updates headers as needed.
For multipart requests (with files), encodes as multipart/form-data. For regular requests, encodes body as JSON.
Returns {:ok, headers, body} or {:error, reason}.