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

echoecho

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

echoecho - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

28

lib/scheme.js

@@ -12,5 +12,16 @@ /*

var headers = {
'Access-Control-Allow-Origin': '*',
'Content-Type': 'text/plain'
};
function mix(reciever, sender) {
Object.keys(sender).forEach(function (key) {
if (!reciever.hasOwnProperty(key)) {
reciever[key] = sender[key];
}
});
return reciever;
}
exports.headers = headers;

@@ -33,3 +44,3 @@

code = ((req.method === 'GET' || req.method === 'HEAD' || req.method === 'OPTIONS') ? 200 : 403);
res.writeHead(code, headers);

@@ -113,3 +124,3 @@ res.end(p.query || '');

json = (p.query ? JSON.stringify(qs.parse(p.query)) : '{ "echo": true }');
if (req.body) {

@@ -119,5 +130,5 @@ json = JSON.stringify(req.body);

res.writeHead(200, {
'Content-type': 'application/json'
});
res.writeHead(200, mix({
'Content-Type': 'application/json'
}, headers));
res.end(json);

@@ -159,7 +170,6 @@ };

res.writeHead(code, {
'Content-type': 'application/json'
});
res.writeHead(code, mix({
'Content-Type': 'application/json'
}, headers));
res.end(json);
};

@@ -5,3 +5,3 @@ {

"author": "Dav Glass <davglass@gmail.com>",
"version": "0.1.0",
"version": "0.1.1",
"devDependencies": {

@@ -8,0 +8,0 @@ "vows": "*",

@@ -176,2 +176,3 @@ var vows = require('vows'),

"with OK body": function(topic) {
assert.equal(topic.headers['access-control-allow-origin'], '*');
assert.equal(topic.code, 200);

@@ -189,2 +190,3 @@ assert.equal(topic.body, 'OK');

"with Not Found body": function(topic) {
assert.equal(topic.headers['access-control-allow-origin'], '*');
assert.equal(topic.code, 404);

@@ -250,2 +252,3 @@ assert.equal(topic.body, 'Not Found');

"with query body": function(topic) {
assert.equal(topic.headers['access-control-allow-origin'], '*');
assert.equal(topic.code, 200);

@@ -263,2 +266,3 @@ assert.equal(topic.body, 'foo=bar');

"with query body": function(topic) {
assert.equal(topic.headers['access-control-allow-origin'], '*');
assert.equal(topic.code, 200);

@@ -265,0 +269,0 @@ assert.equal(topic.body, '');

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