Skip to Content
Node与Express开发(第2版)
book

Node与Express开发(第2版)

by Ethan Brown
June 2021
Intermediate to advanced
290 pages
9h 21m
Chinese
Posts & Telecom Press
Content preview from Node与Express开发(第2版)
request
和
response
对象
|
55
1.
打开
JavaScript
控制台。
2.
点击“
Network
”标签页。
3.
重新加载页面。
4.
从请求列表中选择当前
HTML
(应该是第一个)。
5.
点击“
Headers
”标签页,就可以看到所有的响应头。
6.5
 互联网媒体类型
Content-Type
这个
HTTP
头至关重要,要是没有它,客户端就只能费力地去猜要怎样渲染
内容。
Content-Type
头的格式是一个
互联网媒体类型
,包含类型、子类型以及可选参数。
例如,
text/html; charset=UTF-8
指定了类型为“
text
”,子类型为“
html
”,字符编码为
UTF-8
。“互联网号码分配局”
(
IANA
)维护着互联网媒体类型的官方列表。很多时候,你
会发现“内容类型”“互联网媒体类型”和“
MIME
类型”几个词语被混用。
MIME
(多用
途互联网邮件扩展)曾是互联网媒体类型的前身,如今,二者等价。
6.6
 请求的
Body
除了请求头,请求还可以包含一个
body
(正如响应的
body
是要返回的实际内容一样)。正
常的
GET
请求是不包含
body
的,但
POST
请求通常会包含。对于
POST
的
body
来说,最
常用的媒体类型是
application/x-www-form-urlencoded
,它只是以“
&
”分隔的经过编码
的名
/
值对(基本上跟查询串的格式一样)。如果
POST
请求需要支持文件上传,那么媒体
类型就是
multipart/form-data
,这是一种更复杂的格式。最后,
Ajax
请求的
body
可以使
用
application/json ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

面向对象的思考过程(原书第5版)

面向对象的思考过程(原书第5版)

马特 魏斯费尔德
精通模块化JavaScript

精通模块化JavaScript

Nicolás Bevacqua
前端架构设计

前端架构设计

Micah Godbolt

Publisher Resources

ISBN: 9787115565099