Skip to content
This repository has been archived by the owner on Jul 24, 2019. It is now read-only.

Default to user agent string in npm config if it is provided #298

Merged
merged 2 commits into from
Feb 18, 2015
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion install.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@ function getRequestOptions(conf) {
options.proxy = proxyUrl

// If going through proxy, spoof the User-Agent, since may commerical proxies block blank or unknown agents in headers
options.headers['User-Agent'] = 'curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5'
var userAgent = conf.get('user-agent') || 'curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think this will do what you expect, because user-agent is never empty. you can just remove the ||

options.headers['User-Agent'] = userAgent
}

// Use certificate authority settings from npm
Expand Down