doughsay / tesla_request_id

Tesla middleware for adding x-request-id to outgoing requests.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tesla Request Id Middleware

Build Status Code Coverage Hex.pm

Tesla middleware for adding x-request-id to outgoing requests.

It takes the :request_id property from the Logger metadata and passes it on under the x-request-id header in outgoing http requests made through tesla.

Installation

Add tesla_request_id to your list of dependencies in mix.exs:

def deps do
  [
    {:tesla_request_id, "~> 0.2.0"}
  ]
end

Usage

defmodule MyClient do
  use Tesla
  plug Tesla.Middleware.RequestId
end

Configuration

When adding the middleware, you can specify the name of the header to use for outgoing requests:

plug Tesla.Middleware.RequestId, header_name: "x-transaction-id"

The docs can be found at https://hexdocs.pm/tesla_request_id.

About

Tesla middleware for adding x-request-id to outgoing requests.

License:MIT License


Languages

Language:Elixir 100.0%