1.GET /xxx HTTP/1.1
2.HOST:jack.com: 8002
Content-Type: application/x-www-form-urlencoded
第三部分是回车
4.request.send()
怎样设置请求各部分
第一部分
request.open('post','/xxx')
第二部分
request.setRequestHeader('Content-Type:'x-www-form-urlencoded')
第四部分
request.send('我偏要设置第四部分') //只有post请求可以设置第四部分
怎样获取响应各部分
第一部分 request.status/request.statusText
第二部分 request.getResponseHeader()/request.gerAllResponseHeaders
第四部分 request.responseText
复制代码
转载于:https://juejin.im/post/5c44fe2b6fb9a049d4421dff