在Spring Cloud Gateway中,我想发送自定义错误,以防特定谓词匹配失败。例如: 我有一个路径和标头谓词。像这样-
- id: test
uri: http://localhost:8000/
predicates:
- Path=/consignment
- Header=h,h1
因此,如果路径mathces和标头不存在,则请求失败,并且未找到错误,默认情况下类似
{
"timestamp": "2020-03-08T20:05:42.440+0000",
"path": "/test",
"status": 404,
"error": "Not Found",
"message": null,
"requestId": "6dd2e799"
}
但是我想发送一个自定义响应,提到标题不存在。 有办法吗?