OpenFn / adaptors

The new home for OpenFn adaptors; re-usable connectors for the most common DPGs and DPI building blocks.
GNU General Public License v3.0
7 stars 8 forks source link

common: expose addBasicAuth #521

Open josephjclark opened 7 months ago

josephjclark commented 7 months ago

Many adaptors are copying this function from the new common http helpers:

import {
  makeBasicAuthHeader,
} from '@openfn/language-common/util'

const addBasicAuth = (configuration = {}, headers) => {
  const { username, password } = configuration;
  if (username && password) {
    Object.assign(headers, makeBasicAuthHeader(username, password));
  }
};

Instead of exporting makeBasicAuthHeader, we should export addBasicAuth. Maybe we add options for the user/pass keys on config, just in case.

josephjclark commented 4 months ago

the new common http options() helper makes this clean and easy - I wonder if this is the answer?