feat(net-tool): 添加403 Forbidden响应对象创建方法
All checks were successful
/ release (push) Successful in 26s

This commit is contained in:
zhaoyingbo 2024-11-26 10:21:36 +00:00
parent 815496cf75
commit a7950310b8

View File

@ -56,6 +56,21 @@ class NetTool extends NetToolBase {
): Promise<T> {
return super.patch<T>(url, payload, queryParams, additionalHeaders)
}
/**
* 403 Forbidden的响应对象
*
* @param message -
* @returns 403 Forbidden的响应对象
*/
forbidden(message: string) {
this.logger.error(`return a forbidden response: ${message}`)
return Response.json(
{ code: 403, message, requestId: this.requestId },
{ status: 403 }
)
}
/**
* 400 Bad Request的响应对象
*