Set custom User-Agent header on requests
The Wikimedia Foundation's Varnish setup blocks requests with the
default 'node-fetch' User-Agent string, which we can avoid by setting
a more descriptive and specific custom User-Agent string.
Do this by implementing a simple wrapper on top of node-fetch that sets
the desired User-Agent header, as suggested in . The wrapper is also
a logical place in which to patch in Bluebird as the Promise library,
rather than doing it every time we import fetch.
To ensure all usage of node-fetch is proxied through the wrapper, add an
eslint node/no-restricted-require check for the module.
: https://github.com/wikimedia/puppet/blob/9843300dba/modules/varnish/templates/wikimedia-frontend.vcl.erb#L716-L718 : https://github.com/node-fetch/node-fetch/issues/591#issuecomment-474457866