sindresorhus / ky

🌳 Tiny & elegant JavaScript HTTP client based on the Fetch API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Types for headers

nichoth opened this issue · comments

This library does not see 'Authorization' as a valid header.

    const authRes = await ky.get({
        url: `https://my-api/${apiMethodName}`,
        headers: {
            Authorization: ('Basic ' + btoa(kyId + ':' + password))
        },
    })
image image

@nichoth try this:

const authRes = await ky.get(`https://my-api/${apiMethodName}`, {
  headers: {
    Authorization: 'Basic ' + btoa(kyId + ':' + password)
  }
})

It works!