Skip to content

Commit

Permalink
fix(adapters/http): use pkginfo to determine axios version for http a…
Browse files Browse the repository at this point in the history
…dapter
  • Loading branch information
axe312ger authored and Khaledgarbaya committed Feb 5, 2018
1 parent 7779279 commit 3cf728a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/adapters/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ var httpFollow = require('follow-redirects').http;
var httpsFollow = require('follow-redirects').https;
var url = require('url');
var zlib = require('zlib');
var pkg = require('./../../package.json');
var createError = require('../core/createError');
var enhanceError = require('../core/enhanceError');
var pkginfo = require('pkginfo')(module);

/*eslint consistent-return:0*/
module.exports = function httpAdapter(config) {
Expand All @@ -24,7 +24,7 @@ module.exports = function httpAdapter(config) {
// Only set header if it hasn't been set in config
// See https://github.com/axios/axios/issues/69
if (!headers['User-Agent'] && !headers['user-agent']) {
headers['User-Agent'] = 'axios/' + pkg.version;
headers['User-Agent'] = 'axios/' + pkginfo.version;
}

if (data && !utils.isStream(data)) {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@
"typings": "./index.d.ts",
"dependencies": {
"follow-redirects": "^1.2.5",
"is-buffer": "^1.1.5"
"is-buffer": "^1.1.5",
"pkginfo": "^0.4.1"
},
"bundlesize": [
{
Expand Down

0 comments on commit 3cf728a

Please sign in to comment.