Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Michael Henderson
2,369 PointsNode Basics: Error 408
treehouse:~/workspace$ node app.js
408
BODY:408 Request Time-out
Your browser didn't send a complete request in time.
Printed our by node after:
var request = https.request("https://teamtreehouse.com/michaelhenderson6.json", function(response){ console.log(response.statusCode); response.on('data',function(chunk) { console.log('BODY: ' + chunk); });
Seems like it would be on my end, maybe a permissions thing with chrome? At a loss though, can't finish my project until I can get the data.
1 Answer
Seth Kroger
56,416 PointsThe code I have from this course uses https.get() not https.request().
Seth Kroger
56,416 Pointshttp.request() and https.request() are more general requests, say if you need to upload data for a POST request. Which means the request is left open for you do to that. From the docs:
"With http.request() one must always call req.end() to signify that you're done with the request - even if there is no data being written to the request body. "
Michael Henderson
2,369 PointsMichael Henderson
2,369 PointsThanks, I solved it by closing the request as well. It was timing out without a 'request.end()' tagged to the bottom, T_T