Skip to content

Commit e22041b

Browse files
committed
chore: release v4.5.12
1 parent 5e8061c commit e22041b

File tree

4 files changed

+27
-6
lines changed

4 files changed

+27
-6
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77

88
## [未发布]
99

10+
## [4.5.12] - 2025-12-24
11+
12+
### 修复
13+
14+
- **cURL Header** - 生成 cURL 时不再丢失长 token 请求头(仅跳过过长 User-Agent)
15+
1016
## [4.5.11] - 2025-12-18
1117

1218
### 新增

index.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -934,11 +934,26 @@
934934

935935
// 添加请求头
936936
if (headers && typeof headers === 'object') {
937-
Object.entries(headers).forEach(([key, value]) => {
938-
// 过滤掉空值和过长的值(如 User-Agent)
939-
if (value && value.trim && value.trim() !== '' && value.length < 200) {
940-
curl += ` \\\n -H "${key}: ${value}"`;
937+
Object.entries(headers).forEach(([rawKey, rawValue]) => {
938+
if (rawValue === undefined || rawValue === null) {
939+
return;
940+
}
941+
const key = String(rawKey);
942+
const value = String(rawValue);
943+
if (!value.trim()) {
944+
return;
945+
}
946+
const lowerKey = key.toLowerCase();
947+
const isNoiseHeader =
948+
lowerKey === 'user-agent' ||
949+
lowerKey === 'sec-ch-ua' ||
950+
lowerKey === 'sec-ch-ua-mobile' ||
951+
lowerKey === 'sec-ch-ua-platform';
952+
// 过滤空值,且仅跳过过长且噪音的头(如 User-Agent)
953+
if (isNoiseHeader && value.length > 200) {
954+
return;
941955
}
956+
curl += ` \\\n -H "${key}: ${value}"`;
942957
});
943958
}
944959

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "Cross Request Master",
44
"short_name": "CrossRequest",
55
"description": "YApi 跨域请求扩展 - 开发者工具",
6-
"version": "4.5.11",
6+
"version": "4.5.12",
77
"author": "leeguooooo",
88
"homepage_url": "https://github.com/leeguooooo/cross-request-master",
99
"action": {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cross-request-master",
3-
"version": "4.5.11",
3+
"version": "4.5.12",
44
"description": "YApi 跨域请求扩展",
55
"private": true,
66
"types": "types/cross-request.d.ts",

0 commit comments

Comments
 (0)