mysociety / popit-api

DEPRECATED - Development on PopIt has stopped and it is no longer being maintained
https://goo.gl/Vvej4Q
Other
17 stars 3 forks source link

Fix url generation race condition #120

Closed chrismytton closed 9 years ago

chrismytton commented 9 years ago

Previously we were using eachSchema and schema.options.toJSON to set various configuration options which affected how the json was rendered by mongoose's toJSON method. This was a flawed approach because data could leak between requests if two instances were setting different option simultaneously.

This pull request moves the url generation into a transform.js module, which fixes the race condition with url generation and also should make it reasonably trivial to fix https://github.com/mysociety/popit-api/issues/119.

Fixes https://github.com/mysociety/popit/issues/729

struan commented 9 years ago

This looks good.