- Mastering Node.js(Second Edition)
- Sandro Pasquali Kevin Faaborg
- 158字
- 2021-07-02 19:28:50
The request object
HTTP request and response messages are similar, consisting of the following:
- A status line, which for a request would resemble GET/index.html HTTP/1.1, and for a response would resemble HTTP/1.1 200 OK
- Zero or more headers, which in a request might include Accept-Charset: UTF-8 or From: user@server.com, and in responses might resemble Content-Type: text/html and Content-Length: 1024
- A message body, which for a response might be an HTML page, and for a POST request might be some form data
We've seen how HTTP server interfaces in Node are expected to expose a request handler, and how this handler will be passed some form of a request and response object, each of which implement a readable or writable stream.
We will cover the handling of POST data and Header data in more depth later in this chapter. Before we do, let's go over how to parse out some of the more straightforward information contained in a request.
推薦閱讀
- 網(wǎng)絡(luò)教育學(xué)習(xí)指導(dǎo)
- Web安全防護(hù)指南:基礎(chǔ)篇
- 物聯(lián)網(wǎng)安全(原書(shū)第2版)
- Hands-On Industrial Internet of Things
- JBoss EAP6 High Availability
- 新一代物聯(lián)網(wǎng)架構(gòu)技術(shù):分層算力網(wǎng)絡(luò)
- Getting Started with WebRTC
- Building RESTful Web Services with Spring 5(Second Edition)
- 面向云平臺(tái)的物聯(lián)網(wǎng)多源異構(gòu)信息融合方法
- 城市治理一網(wǎng)統(tǒng)管
- 網(wǎng)絡(luò)基礎(chǔ)與網(wǎng)絡(luò)管理項(xiàng)目化教程
- WordPress Web Application Development
- SRv6網(wǎng)絡(luò)部署指南
- Laravel Application Development Cookbook
- 小型局域網(wǎng)組建