Skip to content

Commit

Permalink
Removed array as valid customUserAgent type
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisradek committed Dec 3, 2015
1 parent b558464 commit 4c59d58
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
4 changes: 1 addition & 3 deletions lib/http.js
Expand Up @@ -109,9 +109,7 @@ AWS.HttpRequest = inherit({
setUserAgent: function setUserAgent(customUserAgent) {
var prefix = AWS.util.isBrowser() ? 'X-Amz-' : '';
var customSuffix = '';
if (Array.isArray(customUserAgent) && customUserAgent.length) {
customSuffix += ' ' + customUserAgent.join('/');
} else if (typeof customUserAgent === 'string' && customUserAgent) {
if (typeof customUserAgent === 'string' && customUserAgent) {
customSuffix += ' ' + customUserAgent;
}
this.headers[prefix + 'User-Agent'] = AWS.util.userAgent() + customSuffix;
Expand Down
6 changes: 0 additions & 6 deletions test/http_request.spec.coffee
Expand Up @@ -31,12 +31,6 @@ describe 'AWS.HttpRequest', ->
request = new AWS.HttpRequest('http://domain.com', '', 'custom')
expect(request.headers).to.eql(headers)

it 'adds the customUserAgent to the user agent header if provided as array', ->
headers = {}
headers[agentHeader] = AWS.util.userAgent() + ' custom/1'
request = new AWS.HttpRequest('http://domain.com', '', ['custom', 1])
expect(request.headers).to.eql(headers)

it 'defaults body to empty string', ->
expect(request.body).to.equal('')

Expand Down

0 comments on commit 4c59d58

Please sign in to comment.