Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aws4

Package Overview
Dependencies
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aws4 - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

10

aws4.js

@@ -36,4 +36,10 @@ var aws4 = exports

// http://docs.aws.amazon.com/general/latest/gr/rande.html
RequestSigner.prototype.isSingleRegion = function() {
return ['cloudfront', 'ls', 'route53', 'iam', 'importexport', 'sts']
.indexOf(this.service) >= 0
}
RequestSigner.prototype.createHost = function() {
var region = ~['iam', 'sts'].indexOf(this.service) ? '' : '.' + this.region
var region = this.isSingleRegion() ? '' : '.' + this.region
return this.service + region + '.amazonaws.com'

@@ -59,3 +65,3 @@ }

if (request.body && !headers['Content-Type'] && !headers['content-type'])
headers['Content-Type'] = 'application/x-www-form-urlencoded'
headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=utf-8'

@@ -62,0 +68,0 @@ headers['X-Amz-Date'] = this.datetime

2

package.json
{
"name": "aws4",
"version": "0.1.4",
"version": "0.1.5",
"description": "Signs and prepares requests using AWS Signature Version 4",

@@ -5,0 +5,0 @@ "author": "Michael Hart <michael.hart.au@gmail.com> (http://github.com/mhart)",

@@ -55,6 +55,11 @@ var should = require('should')

it('should add hostname and default region', function() {
var opts = aws4.sign({ service: 'sqs', headers: { Date: date } })
var opts = aws4.sign({ service: 'sqs' })
opts.hostname.should.equal('sqs.us-east-1.amazonaws.com')
opts.headers['Host'].should.equal('sqs.us-east-1.amazonaws.com')
})
it('should add hostname and no region if service is regionless', function() {
var opts = aws4.sign({ service: 'iam' })
opts.hostname.should.equal('iam.amazonaws.com')
opts.headers['Host'].should.equal('iam.amazonaws.com')
})
it('should populate AWS headers correctly', function() {

@@ -98,3 +103,3 @@ var opts = aws4.sign({ service: 'sqs', headers: { Date: date } })

var opts = aws4.sign({ body: 'SomeAction' })
opts.headers['Content-Type'].should.equal('application/x-www-form-urlencoded')
opts.headers['Content-Type'].should.equal('application/x-www-form-urlencoded; charset=utf-8')
})

@@ -101,0 +106,0 @@ })

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc