gpt4 book ai didi

asp.net - Ocelot Gateway 重复查询参数

转载 作者:行者123 更新时间:2023-12-05 02:32:26 25 4
gpt4 key购买 nike

我正在使用 ocelot 网关。

这里是示例配置

{
"DownstreamPathTemplate": "/ipgeo?apiKey={key}&ip={ip}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "api.ipgeolocation.io",
"Port": 80
}
],
"UpstreamHttpMethod": ["GET"],
"UpstreamPathTemplate": "/GLI/secondary?apiKey={key}&ip={ip}"
}

如您所见,有两个查询参数。当我使用 postman 发送请求时:

http://localhost:5000/GLI/secondary?apiKey=aaa&ip=8.8.8.8

OCELOT 获取重复的查询参数并生成如下下游 url:

 http://api.ipgeolocation.io/ipgeo?apiKey=aaa&ip=8.8.8.8&apiKey=aaa&ip=8.8.8.8

控制台屏幕:

info: Ocelot.Requester.Middleware.HttpRequesterMiddleware[0]
requestId: 0HMFNFVDSDQH9:0000000A, previousRequestId: no previous request id, message: 301 (Moved Permanently) status code, request uri: http://api.ipgeolocation.io/ipgeo?apiKey=aaa&ip=8.8.8.8&apiKey=aaa&ip=8.8.8.8

我怎样才能改变这个?

最佳答案

同样的问题,

我的作品使用这种语法,基本上我已经删除了“?” UpstreamPathTemplate 中的符号:

"DownstreamPathTemplate": "/GLI/secondary?{everything}"

"UpstreamPathTemplate": "/GLI/secondary{everything}"

关于asp.net - Ocelot Gateway 重复查询参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71250588/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com