带有空间的Restsharp baseurl

发布于 2025-01-28 19:31:31 字数 684 浏览 1 评论 0原文

我谷歌搜索它,然后通过数小时尝试如何做,但我无法弄清楚: 我尝试通过RESTSHARP V107在.NET 5中获得Web API的响应 当我在空间空间的底座上做底车时,工作效果很好,但是当我尝试使用空间不起作用的空间时,我找不到404:找不到: 邮递员同样的问题。但是,当我在Chrome或Edge中使用代码编码(%20)时,浏览器返回预期的JSON

示例: new Resclient(“ https://thedomain.name.com/local”)效果很好 但是如果我尝试 new resclient(“ https://thedomain.name.com/my user”)

new Resclient("https://thedomain.name.com/my%20User")

我尝试使用.addurlsegment(“ Elemement”,“我的%20user”) 或.addurlSeggent(“ ellemement”,“我的%20user”)

我认为问题是URL获取解码/编码,并且空间已被删除...

我看到我们有

UseUrlEncoder(Func<string,string>)

,但我没有如何使用它...如果那能解决我的问题,

提前感谢您

I google it and I pass hours try figure how to do it and I can't figure:
I try get Response from web Api with RestSharp v107 in .net 5
Is works well when I do the baseUrl with out space but when I try the one I need with space don't works, I got 404 not found:
Same issue in postman. But when I do in Chrome or in edge with the code encoding (%20) works perfectly the browser return the expected Json

example :
new Resclient("https://thedomain.name.com/local") works well
but if I try
new Resclient("https://thedomain.name.com/my User") or

new Resclient("https://thedomain.name.com/my%20User")

I try the with the .AddUrlSegment("elemement", "my%20User" )
or .AddUrlSegment("elemement", "my%20User" )

I think the issue is the url get decode/encode and the space have been remove...

I see we have

UseUrlEncoder(Func<string,string>)

but I don't how to use it... And if that will solve my issue

Please helps

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文