-
Notifications
You must be signed in to change notification settings - Fork 198
Allow relative URL being used as base URL #330
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
Conversation
@Azure/azure-functions-team @Azure/dotnet-cda to review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yifanbian-msft Thanks for your PR! I found that there's another line 68 for you to take a look. Would you please find and update the line, please?
@justinyoo Actually, for the one on L68, it only gets executed when user didn't specify custom configuration, the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a comment on your change. Could you take a look?
@@ -89,7 +89,7 @@ public ISwaggerUI AddServer(IHttpRequestDataObject req, string routePrefix, IOpe | |||
|
|||
this._baseUrl = servers.First().Url; | |||
|
|||
absolutePath = new Uri(this._baseUrl).AbsolutePath.TrimEnd('/'); | |||
absolutePath = new Uri(this._baseUrl, UriKind.RelativeOrAbsolute).AbsolutePath.TrimEnd('/'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching this! I just took a closer look at the code, maybe we just don't need to parse that URL? I have updated the code, could you take a look?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the long wait! I found that the issue was actually on the other line. Could you take a look and make an appropriate change on your side?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for clarifying your change. They now make sense to me.
Based on the specification, the Server URL might be relative; and when consumer tries to customize the server list, this might block Swagger UI from rendering.
Use the following configuration to repro:
The
Uri(string)
constructor assumes that the URI string is absolute.