如何自定义 WebAPI 2 响应,例如 JSON 格式的状态、数据、消息
请求成功:
{
"status": "success",
"data": {
/* Application-specific data would go here. */
},
"message": null /* Or optional success message */
}
请求失败:
{
"status": "error",
"data": null, /* or optional error payload */
"message": "Error xyz has occurred"
}