有没有办法告诉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以不使用参数来修复。有没有其他方法来解决这个问题?
发布于 2020-01-31 16:56:20
您可以像这样使用{everything}
"DownstreamPathTemplate": "/api/SearchAPI/{everything}"https://stackoverflow.com/questions/59637188
复制相似问题