[英]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}"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.