【前端自学之路】JS之HTTP协议

js http, http协议原理

什么是 http

http(Hyper Text Transfer Protocal)超文本传输协议

属于tcp/ip协议中的 应用层协议 (前端绝大部分请求都是基于HTTP/HTTPS协议的)

状态码

状态码是代表HTTP请求结果的一种状态描述

通常情况有:

  • 100 系列 表示进行中
  • 200 系列 表示成功,如 200
  • 300 系列 表示重定向,如 301永久重定向、302临时重定向、304内容没有变化过
  • 400 系列 表示客户端发生错误,如 404没有这个资源
  • 500 系列 表示服务器内部发生错误,如500服务器问题

具体状态码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
100 "continue"
101 "switching protocols"
102 "processing"
200 "ok"
201 "created"
202 "accepted"
203 "non-authoritative information"
204 "no content"
205 "reset content"
206 "partial content"
207 "multi-status"
208 "already reported"
226 "im used"
300 "multiple choices"
301 "moved permanently"
302 "found"
303 "see other"
304 "not modified"
305 "use proxy"
307 "temporary redirect"
308 "permanent redirect"
400 "bad request"
401 "unauthorized"
402 "payment required"
403 "forbidden"
404 "not found"
405 "method not allowed"
406 "not acceptable"
407 "proxy authentication required"
408 "request timeout"
409 "conflict"
410 "gone"
411 "length required"
412 "precondition failed"
413 "payload too large"
414 "uri too long"
415 "unsupported media type"
416 "range not satisfiable"
417 "expectation failed"
418 "I'm a teapot"
422 "unprocessable entity"
423 "locked"
424 "failed dependency"
426 "upgrade required"
428 "precondition required"
429 "too many requests"
431 "request header fields too large"
500 "internal server error"
501 "not implemented"
502 "bad gateway"
503 "service unavailable"
504 "gateway timeout"
505 "http version not supported"
506 "variant also negotiates"
507 "insufficient storage"
508 "loop detected"
510 "not extended"
511 "network authentication required"

请求头、响应头

待续

待续

坚持原创技术分享,谢谢鼓励我继续创作!