You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] URL path must start with '/' and be of the form '/foo/bar/baz' #1105
I am trying to make a generic class for this, so I would not want to include "contacts" in the route.
Aside from that, his answer would fail as well because there is no leading slash "/".
I submitted a very simple PR to rectify this: #1113
Or use two different interfaces, IContacts, and ISales. As you're setting the base address differently for each, you already have different client instances.
The only difference is, I do not want to be forced to include a leading slash "/".
There are ~100 different entities in Dynamics, so rather than writing hundreds of different methods to perform simple CRUD operations, having a generic service for this seems like the better approach.
I am currently using the multiple service approach but feel it's a lot of wasted time and effort when a single generic class can do it all.
My proposed change simply allows bypassing of the arbitrary enforcement of the leading slash.
The automatic type-safe REST library for .NET Core, Xamarin and .NET. Heavily inspired by Square's Retrofit library, Refit turns your REST API into a live interface. - reactiveui/refit
@mjfara I would recommend using a custom delegating HttpHandler that can rewrite the URLs that you need. We're not going to be changing this behavior at this time.
Hmm, a custom delegating HttpHandler that removes the forced leading slash is pretty hacky when compared to including an option to override the arbitrary enforcement to begin with.
It wouldn't be a change of behavior, but rather an option in the RefitSettings, the default does not change. Not sure why this isn't being considered seeing as it cleanly resolves this issue.
I do appreciate the workaround, but feels hacky to be doing some string substitution on the url. I guess I'll stick with my forked repo for now.
Reacted by Jorge Morales, frantel90, TiDaGo and Xavier César
Activity
arty1901 commentedon Mar 6, 2021
Are you sure that your way of building url is correct? It doesn't make sense
Thats would be better:
Base address: mysite.com
[Get("contacts/{key}")]mjfara commentedon Mar 6, 2021
Yup I'm positive. The Microsoft Dynamics Web Api is using OData.
clairernovotny commentedon Mar 19, 2021
@arty1901's answer looks correct.... can you please explain why that won't work?
mjfara commentedon Mar 19, 2021
I am trying to make a generic class for this, so I would not want to include "contacts" in the route.
Aside from that, his answer would fail as well because there is no leading slash "/".
I submitted a very simple PR to rectify this:
#1113
clairernovotny commentedon Mar 19, 2021
What is the value in having this completely generic?
Like why not have
Or use two different interfaces,
IContacts, andISales. As you're setting the base address differently for each, you already have different client instances.The design here looks strange.
mjfara commentedon Mar 19, 2021
I got this design straight from the refit docs:
https://github.com/reactiveui/refit#using-generic-interfaces
The only difference is, I do not want to be forced to include a leading slash "/".
There are ~100 different entities in Dynamics, so rather than writing hundreds of different methods to perform simple CRUD operations, having a generic service for this seems like the better approach.
I am currently using the multiple service approach but feel it's a lot of wasted time and effort when a single generic class can do it all.
My proposed change simply allows bypassing of the arbitrary enforcement of the leading slash.
clairernovotny commentedon Mar 27, 2021
@mjfara I would recommend using a custom delegating HttpHandler that can rewrite the URLs that you need. We're not going to be changing this behavior at this time.
mjfara commentedon Mar 27, 2021
Hmm, a custom delegating HttpHandler that removes the forced leading slash is pretty hacky when compared to including an option to override the arbitrary enforcement to begin with.
It wouldn't be a change of behavior, but rather an option in the RefitSettings, the default does not change. Not sure why this isn't being considered seeing as it cleanly resolves this issue.
I do appreciate the workaround, but feels hacky to be doing some string substitution on the url. I guess I'll stick with my forked repo for now.
Xavier1708 commentedon Nov 22, 2022
Interessante
github-actions commentedon Apr 13, 2023
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.