Check out a free preview of the full The Hard Parts of Servers & Node.js course
The "Response Headers" Lesson is part of the full, The Hard Parts of Servers & Node.js course featured in this preview video. Here's what you'd learn in this lesson:
Will discusses the headers for the response in HTTP format, and mentions a few additional items the response can include.
Transcript from the "Response Headers" Lesson
[00:00:00]
>> Will Sentance: Two quick things before that, actually, sorry, two brief things before that. One, the return back message [SOUND] is also in HTTP format. We use the body bit of it to send any data, like hello, in the headers of the return back message. It's the same format, get request line with the headlines.
[00:00:18]
This is the headline bit, what you absolutely, the headline, the request headers and the body. The headers bit on the message you send back can also include things like content type. Like, hey, what we're sending back to Michael's Mac is HTML. Hey, web browser Chrome, Safari on Firefox on Michael's Mac, you're receiving here, not plain text, don't try and load it as text, interpret as HTML.
[00:00:43]
And so we can actually add to this message headers and these metadata about the data we're sending back. Say, hey, this is HTML, please interpret it as such, using properties like content type. You're gonna see this in the pair programming. But you've just gotta make sure this message has all the information the browser needs to be able to load up the data in the right way.
Learn Straight from the Experts Who Shape the Modern Web
- In-depth Courses
- Industry Leading Experts
- Learning Paths
- Live Interactive Workshops