This commit is contained in:
parent
a4bb72a717
commit
b6c33ba0eb
@ -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 })
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user