Browse Source

add user-agent to all outgoing requests

master
Guillermo Rauch 9 years ago
parent
commit
d738f8d84a
  1. 2
      lib/index.js
  2. 4
      lib/ua.js

2
lib/index.js

@ -1,6 +1,7 @@
import bytes from 'bytes';
import chalk from 'chalk';
import getFiles from './get-files';
import ua from './ua';
import hash from './hash';
import retry from 'async-retry';
import Agent from './agent';
@ -280,6 +281,7 @@ export default class Now extends EventEmitter {
_fetch (_url, opts = {}) {
opts.headers = opts.headers || {};
opts.headers.authorization = `Bearer ${this._token}`;
opts.headers['user-agent'] = ua;
return this._agent.fetch(_url, opts);
}
}

4
lib/ua.js

@ -0,0 +1,4 @@
import os from 'os';
import { version } from '../package';
export default `now ${version} node-${process.version} ${os.platform()} (${os.arch()})`;
Loading…
Cancel
Save