-
-
Notifications
You must be signed in to change notification settings - Fork 158
Fixed: RelativeLinks #766
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed: RelativeLinks #766
Conversation
Why? The solution (adding a / to the base path) does not seem to have anything to do with absolute/relative links. I'd expect the / to be already in the base path if needed. We should have an integration test for relative links. you can do: var options = (JsonApiOptions)_factory.GetService<IJsonApiOptions>();
options.UseRelativeLinks = true; from within a test, before executing a request. Another approach would be to do something similar to |
c394e1f
to
3e7b658
Compare
@bart-degreed adding the option in the GettingStarted was an attempt to help new users. I reverted the change. Tests have been added for true/false. The change I made seems to work with the responses in the Tests, GettingStarted app, and my apps tested locally. I reviewed the links being created in the following blocks and it seems to behave as expected now. JsonApiDotNetCore/src/JsonApiDotNetCore/Serialization/Server/Builders/LinkBuilder.cs Line 178 in ac5b100
JsonApiDotNetCore/src/JsonApiDotNetCore/Serialization/Server/Builders/LinkBuilder.cs Line 183 in ac5b100
~ JsonApiDotNetCore/src/JsonApiDotNetCore/Serialization/Server/Builders/LinkBuilder.cs Line 188 in ac5b100
|
That the code works does not mean it is the right solution. The base path should be set in middleware and be correct in all cases. I've added tests and fixed the problem to show what I had in mind. Let me know if you agree with this. I also tried to cleanup the |
@bart-degreed, so much better. Thank you. |
@fdlane Thanks for working on this! |
Closes #763
Added commented out
options.RelativeLinks = true;
to the GettingStarted example project.