Skip to content

Commit 10d8600

Browse files
committed
refactor: move functions to parent scope
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent b0856a0 commit 10d8600

File tree

1 file changed

+38
-35
lines changed
  • lib/node_modules/@stdlib/net/disposable-http-server/lib

1 file changed

+38
-35
lines changed

lib/node_modules/@stdlib/net/disposable-http-server/lib/main.js

Lines changed: 38 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,44 @@ var createStore = require( './connections_store.js' );
4343
var debug = logger( 'disposable-http-server' );
4444

4545

46+
// FUNCTIONS //
47+
48+
/**
49+
* Sends a 404 response.
50+
*
51+
* @private
52+
* @param {IncomingMessage} request - HTTP request object
53+
* @param {ServerResponse} response - HTTP response object
54+
*/
55+
function notFound( request, response ) {
56+
debug( 'Sending 404 response...' );
57+
response.statusCode = 404;
58+
response.end();
59+
}
60+
61+
/**
62+
* Sends a 503 response.
63+
*
64+
* @private
65+
* @param {IncomingMessage} request - HTTP request object
66+
* @param {ServerResponse} response - HTTP response object
67+
*/
68+
function unavailable( request, response ) {
69+
debug( 'Sending 503 response...' );
70+
response.statusCode = 503;
71+
response.end();
72+
}
73+
74+
/**
75+
* Callback invoked once a server closes.
76+
*
77+
* @private
78+
*/
79+
function onClose() {
80+
debug( 'Server closed.' );
81+
}
82+
83+
4684
// MAIN //
4785

4886
/**
@@ -221,32 +259,6 @@ function httpServer( options ) {
221259
}
222260
}
223261

224-
/**
225-
* Sends a 404 response.
226-
*
227-
* @private
228-
* @param {IncomingMessage} request - HTTP request object
229-
* @param {ServerResponse} response - HTTP response object
230-
*/
231-
function notFound( request, response ) {
232-
debug( 'Sending 404 response...' );
233-
response.statusCode = 404;
234-
response.end();
235-
}
236-
237-
/**
238-
* Sends a 503 response.
239-
*
240-
* @private
241-
* @param {IncomingMessage} request - HTTP request object
242-
* @param {ServerResponse} response - HTTP response object
243-
*/
244-
function unavailable( request, response ) {
245-
debug( 'Sending 503 response...' );
246-
response.statusCode = 503;
247-
response.end();
248-
}
249-
250262
/**
251263
* Sends HTML content in response to a client request.
252264
*
@@ -312,15 +324,6 @@ function httpServer( options ) {
312324
connections[ keys[i] ].destroy();
313325
}
314326
}
315-
316-
/**
317-
* Callback invoked once a server closes.
318-
*
319-
* @private
320-
*/
321-
function onClose() {
322-
debug( 'Server closed.' );
323-
}
324327
}
325328

326329

0 commit comments

Comments
 (0)