Support resolving OpenAPI server URLs from HttpRequest by captainsafia · Pull Request #60617 · dotnet/aspnetcore (original) (raw)
Closes #57332.
I was previously squeamish about introducing a dependency on HttpRequest
in OpenApiDocumentService.GetOpenApiDocumentAsync
because it ends up being called from the build-time generation codepath but considering some ideas I have in that space I think it's fine for us to introduce a dependency on the HttpRequest for this codepath.
I've retained the codepath that uses the ServerAddressFeature for back-compat in the case that an HttpContext is not available.
Note: this is a backport candidate.