Skip to content

ETag Middleware

Using this middleware, you can add ETag headers easily.

Import

ts
import { Hono } from 'hono'
import { etag } from 'hono/etag'
ts
import { Hono } from 'https://deno.land/x/hono/mod.ts'
import { etag } from 'https://deno.land/x/hono/middleware.ts'

Usage

ts
const app = new Hono()

app.use('/etag/*', etag())
app.get('/etag/abc', (c) => {
  return c.text('Hono is cool')
})

Options

  • weak: boolean
    • Define using or not using a weak validation. If true is set, then w/ is added to the prefix of the value. Default is false.

Released under the MIT License.