About Headers
Headers can be overwritten if specified elsewhere.
Here's the priority from most important to least:
This means that, for example, an Authorization
header set on download
will overwrite the auth
property.
ts
let cobalt = new Cobalt({
instance: 'https://cobalt.instance.example/',
auth: {
scheme: 'Api-Key',
token: 'api-key-1'
}
});
await cobalt.download('https://www.youtube.com/watch?v=VUFr92i5jkA', {
headers: { 'Authorization': 'Api-Key api-key-2' }
});
// Final Authorization header: "Api-Key api-key-2"