Ocelot API 网关可选参数
Ocelot API Gateway Optional Parameter
有没有办法告诉 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}"
有没有办法告诉 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}"