feat(net-tool): 支持自定义状态码响应
All checks were successful
/ release (push) Successful in 25s

This commit is contained in:
zhaoyingbo 2024-09-30 03:56:45 +00:00
parent a4bb72a717
commit b6c33ba0eb

View File

@ -491,13 +491,17 @@ class NetTool extends NetToolBase {
}
/**
* 200 OK的响应对
*
*
* @returns 200 OK的响应对象
* @param status -
* @param data -
* @returns
*/
empty200() {
this.logger.info("return a empty 200 response")
return new Response(null, { status: 200 })
custom(status = 200, data = null as any) {
this.logger.info(
`return a ${status} response${data ? ": " + JSON.stringify(data) : ""}`
)
return new Response(data, { status: status })
}
/**