File tree Expand file tree Collapse file tree 4 files changed +27
-6
lines changed
Expand file tree Collapse file tree 4 files changed +27
-6
lines changed Original file line number Diff line number Diff line change 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### 新增
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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" : {
Original file line number Diff line number Diff line change 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" ,
You can’t perform that action at this time.
0 commit comments