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

bricks

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bricks - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

examples/basic-webserver.js

6

CHANGELOG.md
## Changes
### 1.1.2 - January 13, 2012
* `plugin.request` added `request.body` for `PUT` and `POST`
* update `createServer` to allow for options for `https`
* removed dependency on `date-utils`, added dependency on `cromag`
### 1.1.1 - December 4, 2011

@@ -4,0 +10,0 @@

15

lib/appserver.js

@@ -160,12 +160,19 @@ (function () {

return false;
}
};
AppServer.prototype.createServer = function (server) {
AppServer.prototype.createServer = function (server, options) {
var thisp = this;
server = server || http;
this.server = server.createServer(function (request, response) {
var handler = function (request, response) {
thisp.handleRequest(request, response, thisp);
});
};
if (options === undefined) {
this.server = server.createServer(handler);
} else {
this.server = server.createServer(options, handler);
}
return this.server;

@@ -172,0 +179,0 @@ };

(function () {
var fs = require('fs');
require('date-utils');
var Cromag = require('cromag');

@@ -15,3 +15,3 @@ var logfile;

if (logfile) {
var now = new Date();
var now = new Cromag();
var timestamp = now.toCLFString();

@@ -18,0 +18,0 @@ var referer = request.headers.referer ? request.headers.referer : "-";

(function () {
var fs = require('fs');
require('date-utils');
var Cromag = require('cromag');

@@ -14,3 +14,3 @@ var logfile;

exports.plugin = function (error) {
var timestamp = new Date().toCLFString(),
var timestamp = new Cromag().toCLFString(),
entry = timestamp + ': ' + error;

@@ -17,0 +17,0 @@

@@ -7,3 +7,3 @@ (function() {

require('date-utils');
var Cromag = require('cromag');

@@ -33,3 +33,3 @@ var base;

if (request.headers['if-modified-since']) {
var modified = Date.parse(request.headers['if-modified-since']);
var modified = Cromag.parse(request.headers['if-modified-since']);

@@ -50,6 +50,6 @@ if (modified && modified <= stats.mtime.valueOf()) {

response.setHeader('Content-Type', mime.lookup(file));
response.setHeader('Date', new Date().toUTCString());
response.setHeader('Date', new Cromag().toUTCString());
response.setHeader('Last-Modified', stats.mtime.toUTCString());
response.setHeader('Age', parseInt((new Date().valueOf() - stats.mtime.valueOf()) / 1000));
response.setHeader('Age', parseInt((new Cromag().valueOf() - stats.mtime.valueOf()) / 1000));

@@ -56,0 +56,0 @@ if (options.timeout) {

@@ -27,3 +27,3 @@ (function () {

if (request.method == 'POST') {
if (request.method === 'POST' || request.method === 'PUT') {
var body = '';

@@ -37,2 +37,3 @@

request.query = qs.parse(body);
request.body = body;

@@ -39,0 +40,0 @@ response.next();

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

"description": "Bricks Application Server",
"version": "1.1.1",
"version": "1.1.2",
"homepage": "http://bricksjs.com/",

@@ -22,3 +22,3 @@ "preferGlobal": "true",

"mime": ">=1.2.2",
"date-utils": ">1.0.0",
"cromag": ">0.1.0",
"optimist": ">=0.2",

@@ -25,0 +25,0 @@ "node-uuid": ">1.1.0",

@@ -101,3 +101,31 @@ var vows = require('vows'),

}
},
'events fired at the end of routes': {
topic: function () {
var thisp = this;
var appserver = new server.appserver();
var msg = [ ];
appserver.addRoute(".+", function (request, response) {
response.on("pre.complete", function () { msg.push("pre.complete"); });
response.next();
}, { section: "pre" });
appserver.addRoute(".+", function (request, response, options) {
msg.push("main");
thisp.callback(undefined, msg);
});
var res = new mresponse.response();
var req = new mrequest.request();
req.url = "/bar";
appserver.handleRequest(req, res, appserver);
},
'should be dealt with before the next route starts': function (err, msg) {
assert.equal(err, undefined);
assert.equal(msg[0], "pre.complete");
assert.equal(msg[1], "main");
}
}
}).export(module);
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