All Projects → sascha-wolf → etag_plug

sascha-wolf / etag_plug

Licence: MIT license
A simple to use shallow ETag plug

Programming Languages

elixir
2628 projects

Projects that are alternatives of or similar to etag plug

Plug logger json
Elixir Plug that formats http request logs as json
Stars: ✭ 125 (+594.44%)
Mutual labels:  plug
alternate
Plug and Phoenix helpers to localize your web app via the URL
Stars: ✭ 26 (+44.44%)
Mutual labels:  plug
plug rest
REST behaviour and Plug router for hypermedia web applications in Elixir
Stars: ✭ 52 (+188.89%)
Mutual labels:  plug
Logster
Easily parsable single line, plain text and JSON logger for Plug and Phoenix applications
Stars: ✭ 171 (+850%)
Mutual labels:  plug
elixir plug server timing
Bring Elixir/Phoenix server-side performance metrics 📈 to Chrome's Developer Tools via the Server Timing API. Production Safe™.
Stars: ✭ 49 (+172.22%)
Mutual labels:  plug
plug canonical host
PlugCanonicalHost ensures that all requests are served by a single canonical host.
Stars: ✭ 26 (+44.44%)
Mutual labels:  plug
Ewebmachine
The HTTP decision tree as a plug (full elixir rewriting of basho/webmachine with improvements)
Stars: ✭ 95 (+427.78%)
Mutual labels:  plug
epg
一个处理电信机顶盒焦点的JavaScript插件。
Stars: ✭ 12 (-33.33%)
Mutual labels:  plug
plug-blockchain
The official plug node
Stars: ✭ 16 (-11.11%)
Mutual labels:  plug
phoenix-client-ssl
Set of Plugs / Lib to help with SSL Client Auth.
Stars: ✭ 18 (+0%)
Mutual labels:  plug
Appsignal Elixir
🟪 AppSignal for Elixir package
Stars: ✭ 176 (+877.78%)
Mutual labels:  plug
plug
A collection of pluggable traits for Eloquent (Laravel) models
Stars: ✭ 13 (-27.78%)
Mutual labels:  plug
cache-control
cache-control middleware
Stars: ✭ 41 (+127.78%)
Mutual labels:  etag
Plexy
A toolkit for building excellent APIs with Elixir
Stars: ✭ 152 (+744.44%)
Mutual labels:  plug
guardian trackable
A Guardian hook to track user sign ins.
Stars: ✭ 25 (+38.89%)
Mutual labels:  plug
Reverse proxy plug
🔛 an Elixir reverse proxy Plug with HTTP/2, chunked transfer and path proxying support
Stars: ✭ 112 (+522.22%)
Mutual labels:  plug
taeseung vimrc
Taeseung Lee's vim setting
Stars: ✭ 16 (-11.11%)
Mutual labels:  plug
vue-plug-in
create plug-in for vue
Stars: ✭ 25 (+38.89%)
Mutual labels:  plug
fastapi-etag
Convenience library for working with etags in fastapi
Stars: ✭ 19 (+5.56%)
Mutual labels:  etag
prometheus-plugs
Prometheus.erl Elixir Plugs
Stars: ✭ 52 (+188.89%)
Mutual labels:  plug

ETagPlug

CircleCI Coverage Status Hex.pm License

This plug generates shallow ETags.

Shallow means that it uses the whole response to generate the ETag and does not care about the specific content of each response. It is not context sensitive. For a deep (speak context sensitive) generation of ETags you can take a look at Phoenix ETag.

NOTE: While this plug may seem stale, it's just stable. There is nothing else to do, it "just works". As such don't be afraid to use it in production. 🙂

Installation

The plug can be installed by adding etag_plug to your list of dependencies in mix.exs:

def deps do
  [
    {:etag_plug, "~> 1.0"}
  ]
end

Documentation can be found at: https://hexdocs.pm/etag_plug

Usage

You can simply use the plug without any configuration, it then defaults to the configuration as specified in the "Configuration" section.

plug ETag.Plug

You can also provide a number of options, see the "Configuration" section for details.

plug ETag.Plug,
  generator: MyCustomGenerator,
  methods: ["GET", "HEAD"],
  status_codes: [:ok, 201, :not_modified]

Configuration

A full configuration equal to the defaults could look like this:

config :etag_plug,
  generator: ETag.Generator.SHA1,
  methods: ["GET"],
  status_codes: [200]

Each of these options is explained in detail below.

generator

Expects a module implementing the ETag.Generator behaviour. The plug ships with a number of "default" generators:

  • ETag.Generator.MD5
  • ETag.Generator.SHA1
  • ETag.Generator.SHA512

Default: Application.get_env(:etag_plug, :generator, ETag.Generator.SHA1)

methods

Expects a list of strings, describing the HTTP methods for which ETags should be generated and evaluated.

Default: Application.get_env(:etag_plug, :methods, ["GET"])

status_codes

Expects an enumerable of integers (or status atoms) which define the statuses for which ETags should be handled and generated.

Default: Application.get_env(:etag_plug, :status_codes, [200])

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].