1.请求(ctx.request)的信息
{
method: "GET",
url: "/",
header: {
host: "localhost:3000",
connection: "keep-alive",
cache-control: "max-age=0",
upgrade-insecure-requests: "1",
user-agent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36",
accept: "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
accept-encoding: "gzip, deflate, br",
accept-language: "zh-CN,zh;q=0.9,en;q=0.8"
}
}
2.请求链接地址(ctx.href),在请求的时候拿到整个请求的地址信息,如下地址栏输入的信息
请求ctx.href获取到信息如下
http://localhost:3000/inde.html?username=ziye&pwd=123456
3.再次请求看看 ctx.path会得到什么结果,请求地址
结果如下
/inde.html
4.可以知道ctx.href和ctx.path区别,一个是完整请求地址,一个是域名端口号之后的文件名