Closed cbersch closed 10 years ago
I cannot send a CSL style included in the POSTed JSON data.
The request
curl --header "Content-type: applicatio/json" -X POST http://127.0.0.1:8085 --data @short.json
with the data file short.json
short.json
{"items": {}, "styleXml":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<style xmlns=\"http:\/\/purl.org\/net\/xbiblio\/csl\" class=\"note\" version=\"1.0\">\n<\/style>\n"}
Fails with the server error
ERR! Error while handling request: ReferenceError: postObj is not defined
I can simply fix this by moving the declaration of postObj outside the function, see the patch (I couldn't include it as file):
postObj
diff --git a/lib/citeServer.js b/lib/citeServer.js index df82885..c66eef5 100644 --- a/lib/citeServer.js +++ b/lib/citeServer.js @@ -183,7 +183,7 @@ http.createServer(function (request, response) { request.on('end', function() { log.verbose('POST data completely received'); var parsedQuery, requestConfig, preparedData, postedStyle, - styleUrlObj, citeprocEngine, cslXml; + styleUrlObj, citeprocEngine, cslXml, postObj; Promise.resolve().then(function(){ // Parse url from request object, and merge it with default config @@ -220,7 +220,6 @@ http.createServer(function (request, response) { } //parse post data - var postObj; try { postObj = JSON.parse(request.POSTDATA); }
I use node.js v0.10.26
This is fixed with commit de1ee18cf8.
I cannot send a CSL style included in the POSTed JSON data.
The request
with the data file
short.json
Fails with the server error
I can simply fix this by moving the declaration of
postObj
outside the function, see the patch (I couldn't include it as file):I use node.js v0.10.26