Skip to content

Commit e63019c

Browse files
committed
refactor(test-utils): simplify content handling in filesRoute
1 parent fcbda0a commit e63019c

File tree

1 file changed

+1
-7
lines changed
  • packages/test-utils/src/mock-store/handlers

1 file changed

+1
-7
lines changed

packages/test-utils/src/mock-store/handlers/files.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,19 +142,13 @@ export const filesRoute = defineMockRouteHandler({
142142

143143
// If it's a file with _content, return the content
144144
if (fileNode && "_content" in fileNode && typeof fileNode._content === "string") {
145-
let content = fileNode._content;
145+
const content = fileNode._content;
146146
const contentLength = new TextEncoder().encode(content).length;
147147
const headers: Record<string, string> = {
148148
"Content-Type": "text/plain; charset=utf-8",
149149
[UCD_STAT_TYPE_HEADER]: "file",
150150
};
151151

152-
// Check if the content ends with a newline; if not, add one for better terminal display
153-
if (!content.endsWith("\n")) {
154-
headers["X-Content-Warning"] = "Content did not end with a newline; added for display purposes.";
155-
content += "\n";
156-
}
157-
158152
// Only include size headers for HEAD requests (buffered response)
159153
if (isHeadRequest) {
160154
headers["Content-Length"] = `${contentLength}`;

0 commit comments

Comments
 (0)