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

arc-reply

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arc-reply - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

10

index.js

@@ -22,2 +22,12 @@ module.exports.html = (body, statusCode = 200, response = {}, cookie = false) => {

module.exports.text = (body, statusCode = 200, response = {}, cookie = false) => {
response.headers = Object.assign({ 'content-type': 'application/text; charset=utf8' }, response.headers);
response.body = body;
response.statusCode = statusCode;
if (cookie) {
response.cookie = cookie;
}
return response;
};
module.exports.redirect = (location, type = 'permanent', response = {}, cookie = false) => {

@@ -24,0 +34,0 @@ response.headers = Object.assign({ Location: location }, response.headers);

2

package.json
{
"name": "arc-reply",
"version": "0.2.0",
"version": "0.3.0",
"description": "helper library that simplifies HTTP responses from arc/lambda",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -38,2 +38,12 @@ const tap = require('tap');

tap.test('text', t => {
const r = reply.text('two pints of lager');
t.match(r, {
headers: { 'content-type': 'application/text; charset=utf8' },
body: 'two pints of lager',
statusCode: 200
});
t.end();
});
tap.test('json w cookies and header', t => {

@@ -40,0 +50,0 @@ const r = reply.json({ packet: 'crisps' }, 200, { headers: { 'blah-blah': 'blah' } }, 'token=blah123');

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