Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 45ba67d

Browse filesBrowse files
committed
Remove unused locals/parameters from webTestServer.ts
1 parent acd5740 commit 45ba67d
Copy full SHA for 45ba67d

1 file changed

+5-5Lines changed: 5 additions & 5 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎tests/webTestServer.ts‎

Copy file name to clipboardExpand all lines: tests/webTestServer.ts
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ function dir(dirPath: string, spec?: string, options?: any) {
128128
// fs.rmdirSync won't delete directories with files in it
129129
function deleteFolderRecursive(dirPath: string) {
130130
if (fs.existsSync(dirPath)) {
131-
fs.readdirSync(dirPath).forEach((file, index) => {
131+
fs.readdirSync(dirPath).forEach((file) => {
132132
const curPath = path.join(path, file);
133133
if (fs.statSync(curPath).isDirectory()) { // recurse
134134
deleteFolderRecursive(curPath);
@@ -141,7 +141,7 @@ function deleteFolderRecursive(dirPath: string) {
141141
}
142142
};
143143

144-
function writeFile(path: string, data: any, opts: { recursive: boolean }) {
144+
function writeFile(path: string, data: any) {
145145
ensureDirectoriesExist(getDirectoryPath(path));
146146
fs.writeFileSync(path, data);
147147
}
@@ -208,7 +208,7 @@ enum RequestType {
208208
Unknown
209209
}
210210

211-
function getRequestOperation(req: http.ServerRequest, filename: string) {
211+
function getRequestOperation(req: http.ServerRequest) {
212212
if (req.method === "GET" && req.url.indexOf("?") === -1) {
213213
if (req.url.indexOf(".") !== -1) return RequestType.GetFile;
214214
else return RequestType.GetDir;
@@ -258,7 +258,7 @@ function handleRequestOperation(req: http.ServerRequest, res: http.ServerRespons
258258
break;
259259
case RequestType.WriteFile:
260260
processPost(req, res, (data) => {
261-
writeFile(reqPath, data, { recursive: true });
261+
writeFile(reqPath, data);
262262
});
263263
send(ResponseCode.Success, res, undefined);
264264
break;
@@ -306,7 +306,7 @@ http.createServer((req: http.ServerRequest, res: http.ServerResponse) => {
306306
log(`${req.method} ${req.url}`);
307307
const uri = url.parse(req.url).pathname;
308308
const reqPath = path.join(process.cwd(), uri);
309-
const operation = getRequestOperation(req, reqPath);
309+
const operation = getRequestOperation(req);
310310
handleRequestOperation(req, res, operation, reqPath);
311311
}).listen(port);
312312

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.