Permalink
Browse files

s/updateUrl/updatePath/

  • Loading branch information...
1 parent a2a10b7 commit e3a0d688695714faa2a94567a92e17532a9cc537 @substack committed Jan 15, 2012
Showing with 5 additions and 4 deletions.
  1. +1 −0 lib/insert_headers.js
  2. +2 −2 lib/{update_url.js → update_path.js}
  3. +2 −2 test/url.js
View
@@ -9,6 +9,7 @@ module.exports = function (bufs, headers) {
bytesAdded += b.length;
}
}
+ if (insert.length === 0) return 0;
var w = new Buffer(4);
var ix = [], jx = [];
@@ -1,10 +1,10 @@
-module.exports = function (bufs, url) {
+module.exports = function (bufs, path) {
var ix = indexOf(bufs, ' ', 0, 0);
var jx = indexOf(bufs, ' ', ix[0], ix[1] + 1);
var before = bufs[ix[0]].slice(0, ix[1] + 1);
var after = bufs[jx[0]].slice(jx[1]);
- var middle = Buffer.isBuffer(url) ? url : new Buffer(url);
+ var middle = Buffer.isBuffer(path) ? path : new Buffer(path);
bufs.splice(ix[0], jx[0] - ix[0] + 1, before, middle, after);
View
@@ -1,5 +1,5 @@
var test = require('tap').test;
-var updateUrl = require('../lib/update_url');
+var updatePath = require('../lib/update_path');
var chunky = require('chunky');
test('update url', function (t) {
@@ -15,7 +15,7 @@ test('update url', function (t) {
for (var i = 0; i < times; i++) {
var chunks = chunky(msg);
- var n = updateUrl(chunks, '/boop');
+ var n = updatePath(chunks, '/boop');
t.equal(n, '/beepity'.length - '/boop'.length);
t.equal(
chunks.map(String).join(''),

0 comments on commit e3a0d68

Please sign in to comment.