edicl / drakma

HTTP client written in Common Lisp
http://edicl.github.io/drakma/
249 stars 59 forks source link

Feat: Bearer Authorization #142

Open kilianmh opened 7 months ago

kilianmh commented 7 months ago

Added bearer-authorization and proxy-bearer-authorization. When (and bearer-authorization basic-authorization) or (and proxy-bearer-authorization proxy-basic-authorization) an error is signaled.

Also added tests for error signalling and whether the authorization value appears appropriately in the header.

stassats commented 7 months ago

Is it substantially better than just using :additional-headers?

kilianmh commented 7 months ago

Bearer authorization is widespread nowadays, e.g. for oauth2 and api calls.

Is it substantially better than just using :additional-headers?

Adding new parameters makes it more convenient and less error prone (no typo in "Bearer ").

There is also a sanity check that basic-authorization is not supplied at the same time with bearer-authorization. We could also add a check that gives an error when another authorization header is present in :additional-headers, but that might impact performance more.