added doga
This commit is contained in:
17
25_02_24/node_modules/@tinyhttp/send/dist/sendStatus.js
generated
vendored
Normal file
17
25_02_24/node_modules/@tinyhttp/send/dist/sendStatus.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import { STATUS_CODES } from 'node:http';
|
||||
import { send } from './send.js';
|
||||
/**
|
||||
* Sets the response HTTP status code to statusCode and send its string representation as the response body.
|
||||
*
|
||||
* If an unsupported status code is specified, the HTTP status is still set to statusCode and the string version of the code is sent as the response body.
|
||||
*
|
||||
* @param req Request
|
||||
* @param res Response
|
||||
*/
|
||||
export const sendStatus = (req, res) => (statusCode) => {
|
||||
const body = STATUS_CODES[statusCode] || String(statusCode);
|
||||
res.statusCode = statusCode;
|
||||
res.setHeader('Content-Type', 'text/plain');
|
||||
return send(req, res)(body);
|
||||
};
|
||||
//# sourceMappingURL=sendStatus.js.map
|
||||
Reference in New Issue
Block a user