sindresorhus / ky

🌳 Tiny & elegant JavaScript HTTP client based on the browser Fetch API
MIT License
11.83k stars 341 forks source link

Types for headers #554

Closed nichoth closed 4 months ago

nichoth commented 6 months ago

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
gabrielnafuzi commented 4 months ago

@nichoth try this:

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

It works!