Closed dmitrizagidulin closed 2 years ago
Merging #13 (e04b371) into main (ac47d32) will increase coverage by
0.71%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## main #13 +/- ##
==========================================
+ Coverage 94.28% 95.00% +0.71%
==========================================
Files 2 2
Lines 35 40 +5
==========================================
+ Hits 33 38 +5
Misses 2 2
Impacted Files | Coverage Δ | |
---|---|---|
main.js | 94.73% <100.00%> (+0.79%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update ac47d32...e04b371. Read the comment docs.
It seems like this could be generalized to instead allow a different set of default headers / overrides be passed. Then it could be used for any header(s), not just
Bearer
. It may also be possible to implement that more simply by having an internal property for it that can be updated vs. having to do (another) proxy wrapper.
@dlongley - refactored. Usage is now generic (the options to customClient
are passed through to ky.create()
):
import {customClient} from `@digitalbazaar/http-client`;
const headers = {Authorization: `Bearer ${accessToken}`};
const httpClient = customClient({headers, httpsAgent});
Creates a lightweight wrapper around
httpClient
that adds bearer tokenAuthorization
headers.