Comparing version 3.5.4 to 3.5.5
@@ -0,1 +1,7 @@ | ||
### 3.5.5 | ||
* Ignore searchDomain for localhost and IP - **[@jkrems](https://github.com/jkrems)** [#80](https://github.com/groupon/gofer/pull/80) | ||
- [`8cfb230`](https://github.com/groupon/gofer/commit/8cfb230673dafb6907c0fa7a6d5facc02980ae9b) **fix:** Ignore searchDomain for localhost and IP | ||
### 3.5.4 | ||
@@ -2,0 +8,0 @@ |
@@ -180,2 +180,20 @@ /* | ||
var IPv4 = /^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}$/; | ||
function canApplySearchDomain(hostname) { | ||
if (hostname === 'localhost') return false; | ||
if (hostname[hostname.length - 1] === '.') return false; | ||
// A hostname shouldn't contain ":" (IPv6 adddress) or be an IPv4 address | ||
return hostname.indexOf(':') === -1 && !IPv4.test(hostname); | ||
} | ||
function buildHostname(hostname, searchDomain) { | ||
if (!hostname || typeof hostname !== 'string') { | ||
throw new Error('Invalid URI ' + JSON.stringify(hostname)); | ||
} | ||
if (searchDomain && canApplySearchDomain(hostname)) { | ||
return hostname + '.' + searchDomain + '.'; | ||
} | ||
return hostname; | ||
} | ||
function fetchUrlObj(urlObj, options) { | ||
@@ -208,11 +226,4 @@ if (options.baseUrl && typeof options.baseUrl === 'string') { | ||
var hostname = urlObj.hostname; | ||
if (!hostname || typeof hostname !== 'string') { | ||
throw new Error('Invalid URI ' + JSON.stringify(hostname)); | ||
} | ||
var hostname = buildHostname(urlObj.hostname, options.searchDomain); | ||
if (options.searchDomain && hostname[hostname.length - 1] !== '.') { | ||
hostname += '.' + options.searchDomain + '.'; | ||
} | ||
var agent = getAgent(options, urlObj); | ||
@@ -219,0 +230,0 @@ assign(agent.options, { |
{ | ||
"name": "gofer", | ||
"version": "3.5.4", | ||
"version": "3.5.5", | ||
"description": "A general purpose service client library", | ||
@@ -5,0 +5,0 @@ "license": "BSD-3-Clause", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63191
1284