Why refit cares too much about url path's starting charecter? #1604
-
|
Exception's message that I've got: What's the benefit of this exception? How refit knows about my http client's base address? what if my base address is something like |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
The leading What actually happens:
For your case:
So the exception is just telling you to write the attribute path in the canonical Reference: VerifyUrlPathIsSane in RestMethodInfo.cs (the validator) and the path is combined with |
Beta Was this translation helpful? Give feedback.
The leading
/is just a syntax convention Refit enforces on the path you put in the attribute. It does not mean Refit ignores your base address.What actually happens:
HttpClient.BaseAddress.AbsolutePath(for example/v1/fromhttps://api.mycompany.com/v1/) and prepends it to your method path./v1/.For your case:
https://api.mycompany.com/v1/(keep the trailing slash).[Get("/api/Category/Get")](with the leading slash, to satisfy the validator).https://api.mycompany.com/v1/api/Category/Get.So the exception is just telling you to write the attribute path in the canonical
/foo/bar/bazfor…