@faapi/faapi 1.0.2 → 1.1.0-canary.4b0611b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +4 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +10 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -1206,6 +1206,7 @@ var init_resolveInjection = __esm({
|
|
|
1206
1206
|
// 别名
|
|
1207
1207
|
cookies: "cookies",
|
|
1208
1208
|
ip: "ip",
|
|
1209
|
+
ua: "ua",
|
|
1209
1210
|
files: "files",
|
|
1210
1211
|
fields: "fields"
|
|
1211
1212
|
};
|
|
@@ -4396,6 +4397,7 @@ function createContext(request, params, config = {}, ip = "") {
|
|
|
4396
4397
|
method: request.method,
|
|
4397
4398
|
path: url.pathname,
|
|
4398
4399
|
ip,
|
|
4400
|
+
ua: request.headers.get("user-agent") ?? "",
|
|
4399
4401
|
cookies: cookiesObj,
|
|
4400
4402
|
config,
|
|
4401
4403
|
meta,
|
|
@@ -4766,6 +4768,8 @@ function getBuiltinInjectionValue(type, ctx, body) {
|
|
|
4766
4768
|
return ctx.cookies;
|
|
4767
4769
|
case "ip":
|
|
4768
4770
|
return ctx.ip;
|
|
4771
|
+
case "ua":
|
|
4772
|
+
return ctx.ua;
|
|
4769
4773
|
case "body":
|
|
4770
4774
|
return body;
|
|
4771
4775
|
// form 与 body 共享解析结果(resolveInput 已按 Content-Type 解析 form-urlencoded)
|