braid-http 0.1.9 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -357,7 +357,7 @@ var subscription_parser = (cb) => ({
357
357
  this.state.input += input
358
358
 
359
359
  // Now loop through the input and parse until we hit a dead end
360
- do {
360
+ while (this.state.input.trim() !== '') {
361
361
  this.state = parse_version (this.state)
362
362
 
363
363
  // Maybe we parsed a version! That's cool!
@@ -380,7 +380,8 @@ var subscription_parser = (cb) => ({
380
380
  }
381
381
 
382
382
  // We stop once we've run out of parseable input.
383
- } while (this.state.result !== 'waiting' && this.state.input.trim() !== '')
383
+ if (this.state.result == 'waiting') break
384
+ }
384
385
  }
385
386
  })
386
387
 
@@ -552,14 +553,14 @@ function parse_body (state) {
552
553
 
553
554
  // Parse Patches
554
555
 
555
- else if (state.headers.patches) {
556
+ else if (state.headers.patches != null) {
556
557
  state.patches = state.patches || []
557
558
 
558
559
  var last_patch = state.patches[state.patches.length-1]
559
560
 
560
561
  // Parse patches until the final patch has its content filled
561
562
  while (!(state.patches.length === state.headers.patches
562
- && 'content' in last_patch)) {
563
+ && (state.patches.length === 0 || 'content' in last_patch))) {
563
564
 
564
565
  state.input = state.input.trimStart()
565
566
 
@@ -43,9 +43,8 @@ function generate_patches(res, patches) {
43
43
  // Build up the string as a result
44
44
  var result = ''
45
45
 
46
- // Add `Patches: N` header if we have multiple patches
47
- if (patches.length > 1)
48
- result += `Patches: ${patches.length}\r\n\r\n`
46
+ // Add `Patches: N` header
47
+ result += `Patches: ${patches.length}\r\n\r\n`
49
48
 
50
49
  // Generate each patch
51
50
  patches.forEach((patch, i) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "braid-http",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "An implementation of Braid-HTTP for Node.js and Browsers",
5
5
  "scripts": {
6
6
  "test": "node test/server.js"