mikeal / node.couchapp.js

Utility for writing couchapps.
Apache License 2.0
406 stars 78 forks source link

Cannot safely push multiple times #15

Closed shimaore closed 9 years ago

shimaore commented 13 years ago

I use code like the following (CoffeeScript):

couchapp = require 'couchapp'
for script in ['authorize','replicate','global']
  couchapp.createApp require("./#{script}"), uri, (app)-> app.push()

in order to push multiple design documents at once,

However this does not work because couchapp shares the "headers" parameter (var h) between multiple request() instances.

(The issue happens whether the push() operations are in parallel (my example above) or serialized.)

Fix: copy line 11 in main.js so that each request(...) call gets its own, independent set of headers.

shimaore commented 13 years ago

Fix: https://gist.github.com/1046898