是否可以告诉Ocelot参数是可选的?
假设下面的查询参数是可选的:
"DownstreamPathTemplate": "/api/SearchAPI/?query={query}",
"DownstreamScheme": "https",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 5000
}
],
"UpstreamPathTemplate": "/api/SearchAPI/?query={query}",
"UpstreamHttpMethod": [ "GET" ],
"FileCacheOptions": {
"TtlSeconds": 60
}
如果我向/SearchAPI/?query=
发送请求,则会收到404
作为响应。我需要复制Upstream
以不使用参数进行修复。还有另一种解决方法吗?
您可以像使用{everything}
"DownstreamPathTemplate": "/api/SearchAPI/{everything}"