Skip to content
Discussion options

You must be logged in to vote

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:

  • Refit reads HttpClient.BaseAddress.AbsolutePath (for example /v1/ from https://api.mycompany.com/v1/) and prepends it to your method path.
  • So your base path is preserved. You do not lose /v1/.

For your case:

  • Base address: https://api.mycompany.com/v1/ (keep the trailing slash).
  • Attribute: [Get("/api/Category/Get")] (with the leading slash, to satisfy the validator).
  • Final URL: 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/baz for…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by glennawatson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants