Skip to content

Commit

Permalink
added better test coverage and fixed broken notification tests
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianBelhumeur committed Jul 22, 2013
1 parent c119c04 commit 8c3cde2
Show file tree
Hide file tree
Showing 8 changed files with 867 additions and 562 deletions.
8 changes: 6 additions & 2 deletions lib/jsonrpc.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ module.exports = (function(){
},
sendResponse = function () {
var finalOutput;
var contentLength, code;

if ( responseList.length ) {
if ( ! isBatch ) {
Expand All @@ -187,10 +188,13 @@ module.exports = (function(){
}
}

res.writeHead( 200,
contentLength = Buffer.byteLength( finalOutput || '');
code = contentLength ? 200 : 204;

res.writeHead( code,
{
'Content-Type': 'application/json',
'Content-Length': Buffer.byteLength( finalOutput || '' )
'Content-Length': contentLength
}
);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-express-json-rpc2",
"version": "1.0.1",
"version": "1.0.2",
"description": "Route-based JSON-RPC middleware for Express",
"keywords": [
"json-rpc",
Expand Down
6 changes: 3 additions & 3 deletions test/testServer/public/index.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<script src="javascripts/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="javascripts/qunit.js"></script>
<script src="javascripts/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="javascripts/qunit-1.12.0.js"></script>
<script type="text/javascript" src="javascripts/unitTests.js"></script>
<link rel="stylesheet" href="stylesheets/qunit.css" type="text/css" media="screen" />
<link rel="stylesheet" href="stylesheets/qunit-1.12.0.css" type="text/css" media="screen" />
</head>
<body>
<h1 id="qunit-header">JSON-RPC 2 Node module tests</h1>
Expand Down
6 changes: 6 additions & 0 deletions test/testServer/public/javascripts/jquery-1.10.2.min.js

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions test/testServer/public/javascripts/jquery-1.7.2.min.js

This file was deleted.

Loading

0 comments on commit 8c3cde2

Please sign in to comment.