View Source CurlReq.Plugin (CurlReq v0.98.5)

A collection of steps, usable with Req.

Info

This plugin needs to be added behind any other Req.Steps. Steps add headers and change the request, and this all has to be done before converting the request to a curl command.

Examples

iex> Req.new(url: "https://catfact.ninja/fact")
...> |>CurlReq.Plugin.attach()

iex> Req.new(url: "https://catfact.ninja/fact")
...> |> CurlReq.Plugin.attach(log_level: :info, log_metadata: [ansi_color: :blue])

Possible improvements

This module could be improved. PRs are welcome!

  • [ ] configure redaction on a per-header basis

See also TeslaCurl for inspiration.

Summary

Functions

Attaches the plugin, main entry point for this module.

Req step: logs the request.

Types

@type option() :: {:log_level, Logger.level()} | {:log_metadata, any()}

Functions

Link to this function

attach(request, options \\ [])

View Source
@spec attach(Req.Request.t(), [option()]) :: Req.Request.t()

Attaches the plugin, main entry point for this module.

Req step: logs the request.