我们有一个 ocelot 网关,可以将我们以前的 WCF 请求重新路由到更新的 .NET Core 服务。一些旧请求仍将发送到 WCF 服务。这一切都很好。
现在我想将带有请求模型的 POST重新路由到带有查询字符串和标头的 GET 。我似乎无法弄清楚如何做到这一点,所以我有点期望查询字符串参数能够开箱即用并为标题做一些自定义的事情。
这是我的重新路由json:
{
"DownstreamPathTemplate": "/v1/attachments",
"DownstreamScheme": "http",
"DownstreamHttpMethod": [ "GET" ],
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 53737
}
],
"UpstreamPathTemplate": "/mobile/ImageService.svc/json/GetImage",
"UpstreamHttpMethod": [ "POST" ],
"UpstreamHost": "*"
}
我的请求正文:
{
"SessionId":"XXX", //needs to be a header
"ImageId": "D13XXX", //needs to be added to query string
"MaxWidth" : "78", //needs to be added to query string
"MaxHeight" : "52", //needs to be added to query string
"EditMode": "0" //needs to be added to query string
}
是否可以在 ocelot 中配置它以便正确重新路由?如果是这样,你能指出我正确的方向吗?