Comparing version 1.0.0 to 1.0.1
@@ -13,2 +13,3 @@ /* | ||
var _ = require("lodash"); | ||
var querystring = require("querystring"); | ||
@@ -235,3 +236,3 @@ var filterSettings = function( settings, payload ) { | ||
if ( /^payload=/.test( data ) ) { | ||
var payload = JSON.parse( data.slice(8) ); | ||
var payload = JSON.parse( querystring.unescape(data.slice(8)) ); | ||
eventaur.emit( "payload", payload ); | ||
@@ -238,0 +239,0 @@ } |
{ | ||
"name": "gith", | ||
"description": "gith[ooks] - a simple node server that responds to github post-receive events with meaningful data", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"homepage": "https://github.com/danheberden/gith", | ||
@@ -6,0 +6,0 @@ "author": { |
var githFactory = require('../lib/gith.js'); | ||
var http = require('http'); | ||
var _ = require('lodash'); | ||
var querystring = require('querystring'); | ||
@@ -97,3 +98,3 @@ /* | ||
}, | ||
'gith creates a server and listens to payloads on that port': function( test ) { | ||
'gith creates a server and listens to unescaped payloads on that port': function( test ) { | ||
test.expect(1); | ||
@@ -127,2 +128,32 @@ var gith = githFactory.create( 9001 ); | ||
request.end(); | ||
}, | ||
'gith creates a server and listens to escaped payloads on that port': function( test ) { | ||
test.expect(1); | ||
var gith = githFactory.create( 9001 ); | ||
var payloadObject = require('./payloads/add-file-and-dir.json'); | ||
var failSafe = false; | ||
gith().on( 'all', function( payload ) { | ||
failSafe = true; | ||
test.equal( payload.original.after, payloadObject.after, "payload data should equal sent payload data" ); | ||
gith.close(); | ||
test.done(); | ||
}); | ||
// just incase | ||
setTimeout( function() { | ||
if ( !failSafe ) { | ||
gith.close(); | ||
test.ok( false, 'payload event never fired after 200ms, shutting down server' ); | ||
test.done(); | ||
} | ||
}, 200 ); | ||
var request = http.request({ | ||
port: 9001, | ||
host: 'localhost', | ||
method: 'POST' | ||
}); | ||
request.write( 'payload=' + querystring.escape( JSON.stringify( payloadObject ) ) ); | ||
request.end(); | ||
} | ||
@@ -129,0 +160,0 @@ }; |
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
49438
1557