(headersString: string)
| 507 | |
| 508 | // TM Xhr Header 兼容处理,原生xhr \r\n 在尾,但TM的GMXhr没有;同时除去冒号后面的空白 |
| 509 | export const normalizeResponseHeaders = (headersString: string) => { |
| 510 | if (!headersString) return ""; |
| 511 | let out = ""; |
| 512 | headersString.split("\n").forEach((line) => { |
| 513 | const j = line.indexOf(":"); |
| 514 | if (j > 0) { |
| 515 | const headerName = line.substring(0, j); // "key" |
| 516 | const headerValue = line.substring(j + 1).trim(); // "value" |
| 517 | out += `${headerName}:${headerValue}\r\n`; |
| 518 | } |
| 519 | }); |
| 520 | return out.substring(0, out.length - 2); // 去掉最后的 \r\n |
| 521 | }; |
| 522 | |
| 523 | // 获取本周是第几周 |
| 524 | // 遵循 ISO 8601, 一月四日为Week 1,星期一为新一周 |
no test coverage detected