Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/doughsay/tesla_request_id
Tesla middleware for adding x-request-id to outgoing requests.
https://github.com/doughsay/tesla_request_id
Last synced: 17 days ago
JSON representation
Tesla middleware for adding x-request-id to outgoing requests.
- Host: GitHub
- URL: https://github.com/doughsay/tesla_request_id
- Owner: doughsay
- License: mit
- Created: 2018-06-16T04:17:02.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-08-02T13:14:40.000Z (over 3 years ago)
- Last Synced: 2024-10-19T13:34:29.140Z (26 days ago)
- Language: Elixir
- Size: 135 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Tesla Request Id Middleware
[![Build Status](https://travis-ci.com/doughsay/tesla_request_id.svg?branch=master)](https://travis-ci.com/doughsay/tesla_request_id)
[![Code Coverage](https://img.shields.io/codecov/c/github/doughsay/tesla_request_id.svg)](https://codecov.io/gh/doughsay/tesla_request_id)
[![Hex.pm](https://img.shields.io/hexpm/v/tesla_request_id.svg)](http://hex.pm/packages/tesla_request_id)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`:
```elixir
def deps do
[
{:tesla_request_id, "~> 0.2.0"}
]
end
```## Usage
```elixir
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:
```elixir
plug Tesla.Middleware.RequestId, header_name: "x-transaction-id"
```The docs can
be found at [https://hexdocs.pm/tesla_request_id](https://hexdocs.pm/tesla_request_id).