- 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.
推薦閱讀
- CorelDRAW X6 中文版圖形設(shè)計實(shí)戰(zhàn)從入門到精通
- Getting Started with WebRTC
- 面向云平臺的物聯(lián)網(wǎng)多源異構(gòu)信息融合方法
- 物聯(lián)網(wǎng)與無線傳感器網(wǎng)絡(luò)
- React:Cross-Platform Application Development with React Native
- Getting Started with Grunt:The JavaScript Task Runner
- IPv6網(wǎng)絡(luò)切片:使能千行百業(yè)新體驗(yàn)
- Microservice Patterns and Best Practices
- 網(wǎng)絡(luò)基礎(chǔ)與網(wǎng)絡(luò)管理項目化教程
- 網(wǎng)絡(luò)工程實(shí)施技術(shù)與方案大全
- AIoT應(yīng)用開發(fā)與實(shí)踐
- 局域網(wǎng)組成實(shí)踐
- 現(xiàn)場綜合化網(wǎng)絡(luò)運(yùn)營與維護(hù):運(yùn)營商數(shù)字化轉(zhuǎn)型技術(shù)與實(shí)踐
- 物聯(lián)網(wǎng),So Easy!
- 區(qū)塊鏈技術(shù)與應(yīng)用:打造分布式商業(yè)新生態(tài)