@govuk-one-login/frontend-passthrough-headers
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

@govuk-one-login/frontend-passthrough-headers

Purpose

@govuk-one-login/frontend-passthrough-headers is a set of functions to extract pass-through headers that should be passed through our frontends to our backends.

Table of Contents

  1. Installation
  2. How to use
  3. Issues

Installation

Add to your project using npm i @govuk-one-login/frontend-passthrough-headers

How to use

createPersonalDataHeaders

[!WARNING] This function extracts headers that contain Personal Data. It must not be passed through to API calls to external services.

import { createPersonalDataHeaders } from "@govuk-one-login/frontend-passthrough-headers";

async function routeHandler(req, res, next) {
  const url = "https://internal-service.com/do-something";

  const headers = {
    ...createPersonalDataHeaders(url, req),
  };

  const res = await axios.get(url, {
    headers,
  });

  return res.data;
}

Issues

Please raise any issues on the GitHub repo.

Readme

Keywords

none

Package Sidebar

Install

npm i @govuk-one-login/frontend-passthrough-headers

Weekly Downloads

332

Version

1.1.0

License

ISC

Unpacked Size

35.5 kB

Total Files

29

Last publish

Collaborators

  • joanneyoung01
  • andyholme-gds
  • di-fabs
  • pcornishgds
  • wilsondrrn
  • merlinc