url,path,query,headers

2017-11-18  本文已影响129人  余生筑

Schema://host:port/path?query#hash

=协议://主机名:端口号url
=协议://域名/路径?参数集合#hash

http://localhost:8080/Hello?i_need_money=true&how_much=1000

等效于

http://127.0.0.1:8080/Hello?i_need_money=true&how_much=1000

由于端口号一般对应于协议名,So协议名可省略

localhost:8080/Hello?i_need_money=true&how_much=1000

其中

req.url=/Hello?i_need_money=true&how_much=1000
/Hello
{
 i_need_money: 'true', 
how_much: '1000'
 }
{ host: '127.0.0.1:8080',
  connection: 'keep-alive',
  'content-length': '35',
  'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (K
HTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36',
  'cache-control': 'no-cache',
  origin: 'chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop',
  'postman-token': 'd5ad522c-6cff-3c75-d724-a9e0e3a40743',
  'content-type': 'application/x-www-form-urlencoded',
  accept: '*/*',
  'accept-encoding': 'gzip, deflate, br',
  'accept-language': 'zh-CN,zh;q=0.9' }

注意

url,path,query负责告诉服务器资源的筛选条件
headers内容规定request传递给response的数据格式(form-data,json,html)
请求实体才真正放request传递给response的数据

端口

上一篇下一篇

猜你喜欢

热点阅读