MCPcopy Index your code
hub / github.com/scriptscat/scriptcat / normalizeResponseHeaders

Function normalizeResponseHeaders

src/pkg/utils/utils.ts:509–521  ·  view source on GitHub ↗
(headersString: string)

Source from the content-addressed store, hash-verified

507
508// TM Xhr Header 兼容处理,原生xhr \r\n 在尾,但TM的GMXhr没有;同时除去冒号后面的空白
509export 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,星期一为新一周

Callers 2

utils.test.tsFile · 0.90
callbackMethod · 0.90

Calls 1

forEachMethod · 0.80

Tested by

no test coverage detected