Closed fiznool closed 9 years ago
Unfortunately this new test will break if setting async
to true
. No idea why! Probably best just to keep async
to false
for the time being :smile:
Added a new issue to the xml2js library to track the async: true
problem.
@fiznool Release v0.2.2 is out. Just in case, I also added a note about the async
issues to the README.md.
Thanks again for your support!
No problem - glad to help out. :smile:
Here's another subtle one.
I was seeing an issue where the first time a non-XML request was received, an error was being thrown, but on subsequent requests, no error was apparent.
After pouring through the xml2js source I realised that the
parseString
instance method isn't reusable. You need to create a new parser each time you want to callparseString
. The reason for this is that the parser sets an instance variable when the underlying saxParser throws an error, and this needs to be reset in between invocations ofparseString
. The easiest way to achieve this is to just create a new parser per request, which is what the convenience function in the xml2js module also does.I've added a new test case to reproduce this behaviour.