mithril-global-request-headers
v0.0.3
Published
A simple module for adding global headers to xhr in mithril
Downloads
3
Readme
mithril-global-request-headers
A simple (POC) module for adding global http headers support to m.request.
Eg
Init
require('mithril-global-request-headers')(m)
Add a header
require('mithril-global-request-headers')(m)
m.addGlobalHeader('authorization', 'key...')
Remove headers
require('mithril-global-request-headers')(m)
m.addGlobalHeader('authorization', 'key...')
m.removeGlobalHeader('authorization', 'key...') // Remove exact
m.addGlobalHeader('authorization', 'key...')
m.removeGlobalHeader('authorization') // Remove based on key match
Access all configured headers
require('mithril-global-request-headers')(m)
m.getGlobalHeaders()
Don't add global headers to a single request
require('mithril-global-request-headers')(m)
m.request({ disableGlobalHeaders: true, ... })