koa-request-id:添加请求ID

时间:2021-05-20 05:54:34
【文件属性】:
文件名称:koa-request-id:添加请求ID
文件大小:3KB
文件格式:ZIP
更新时间:2021-05-20 05:54:34
JavaScript koa-request-id 如果设置为从查询字符串或标头重用一个请求,则将请求id添加为this.id 。 例子 var koa = require ( 'koa' ) ; var requestId = require ( 'koa-request-id' ) ; var app = koa ( ) ; app . use ( requestId ( ) ) ; app . use ( function * ( ) { this . body = this . id ; } ) ; app . listen ( 3000 ) ; 查询它: $ curl http://localhost:3000 23691882-abd8-4857-88f3-41a7f962aefd $ curl http://localhost:3000/ ? request-id=1337 1337
【文件预览】:
koa-request-id-master
----.gitignore(13B)
----Readme.md(786B)
----package.json(405B)
----index.js(437B)
----test.js(675B)
----.travis.yml(38B)
----Makefile(66B)

网友评论