used _baseUrl.AbsoluteUri instead of _baseUrl to avoid included port number in the self link #206
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi Jouke,
This is small PR to fix one small issue. It happens for us only when we host it under IIS (Win10\WinServer 2016 and probably all others too).
The issue is that top self link always includes port even if port is standard like this:
or like this
It's still valid url as it can contain port, but it looks a bit weird. Somehow IIS always pushes port in the
Request.Url
and_baseUrl.OriginalUrl
always has it, and when we pass Uri as object for serialization, then Newtonsoft.Json uses.OriginalUrl
and it gives us 80\443 ports for regular http\https hosting.I pushed change to use
_baseUri.AbsoluteUri
in theResourceSerializer
and also updated a couple of unit tests as they were using Uri from JObject but now it has just regular string. I also added unit test forResourceSerializer
to test this specific case. Also i verified that non standard ports still are displayed under IIS\IIS ExpressHere is also screenshot of VisualStudio watch that shows current values during debug
Full response example before fix looks like it: