Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Response data crashes node #8

Open
dhalford opened this issue Oct 12, 2010 · 1 comment
Open

Response data crashes node #8

dhalford opened this issue Oct 12, 2010 · 1 comment

Comments

@dhalford
Copy link

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)

@dhalford
Copy link
Author

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant