Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Response data crashes node #8

Open
deanotron opened this Issue · 1 comment

1 participant

@deanotron

I haven't been able to get further down the stack from this but it looks like the page responses are not being templated properly

for each response node is failing at http://github.com/kriszyp/jsgi-node/zipball/v0.2.1!/lib/jsgi-node.js:165:18
forEachResult = data.body.forEach( function( chunk ) {
response.write( chunk, data.body.encoding || "utf8" );
});

Adding a try/catch around this shows that the problem is that the chunk being passed through is a js object rather than a string. here is the output from each chunk:

chunk 0:
<html><body>

chunk 1:
{ pageName: 'Example'
, content: '<p>asdf asdf asdf</p>'
, location: undefined
}
{ message: 'first argument must be a string, Array, or Buffer'
, stack: [Getter/Setter]
}

chunk 2:
<body></html>

TypeError: first argument must be a string, Array, or Buffer
at ServerResponse.write (http:488:11)
at jar:http://github.com/kriszyp/jsgi-node/zipball/v0.2.1!/lib/jsgi-node.js:165:18
at Object.forEach (eval at (jar:http://github.com/dmachi/templify/zipball/master!/lib/template.js:32:12))
at jar:http://github.com/kriszyp/pintura/zipball/v0.2.2!/lib/media/html.js:66:24
at jar:http://github.com/kriszyp/promised-io/zipball/v0.2.1!/lib/promise.js:320:10
at jar:http://github.com/kriszyp/pintura/zipball/v0.2.2!/lib/media/html.js:65:13
at notify (jar:http://github.com/kriszyp/promised-io/zipball/v0.2.1!/lib/promise.js:162:22)
at [object Object].then (jar:http://github.com/kriszyp/promised-io/zipball/v0.2.1!/lib/promise.js:215:4)
at jar:http://github.com/kriszyp/promised-io/zipball/v0.2.1!/lib/promise.js:314:20
at Object.forEach (jar:http://github.com/kriszyp/pintura/zipball/v0.2.2!/lib/media/html.js:64:12)

@deanotron

Adjusting templify to return the template path with '.template' fixes the problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.