Skip to content

MD5 Hashing Interceptor

Used to compute MD5 hashes for request parameters and headers.

Import

ts
import { requestMd5Interceptor } from 'rattail/axle'

Usage

ts
axle.useRequestInterceptor(
  requestMd5Interceptor({
    mappings: [
      {
        url: '/user',
        method: 'post',
        path: ['name', 'password'],
      },
      {
        url: (url) => url.startsWith('/secure'),
        method: 'put',
        path: ['token'],
      },
    ],
  }),
)

Mapping Options

OptionTypeDescription
urlstring | ((url: string) => boolean)URL to match
methodstringHTTP method to match
pathstring[]Fields to compute MD5 hash for