Comparing version 2.0.0 to 2.1.0
@@ -52,7 +52,7 @@ const objectToCookie = (obj) => { | ||
module.exports.redirect = (location, options) => { | ||
module.exports.redirect = (location, options = {}) => { | ||
const response = setResponse(options); | ||
response.headers = Object.assign({ Location: location }, response.headers); | ||
response.statusCode = options.type === 'permanent' ? 301 : 302; | ||
response.statusCode = options.type === 'temporary' ? 302 : 301; | ||
return response; | ||
}; |
{ | ||
"name": "arc-reply", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "helper library that simplifies HTTP responses from arc/lambda", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -72,3 +72,3 @@ const tap = require('tap'); | ||
tap.test('redirect', t => { | ||
const perm = reply.redirect('https://google.com', { type: 'permanent' }); | ||
const perm = reply.redirect('https://google.com'); | ||
const temp = reply.redirect('https://google.com', { type: 'temporary' }); | ||
@@ -75,0 +75,0 @@ t.match(perm, { |
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
6212