private async Task ReturnDocument(HttpContext httpContext, OpenRpcGenerator openRpcGenerator, string documentName) { // TODO test if url is correctly created in middleware var host = new UriBuilder(httpContext.Request.GetEncodedUrl()) { Path = null, Fragment = null, Query = null }; if (options.Docs.TryGetValue(documentName, out var info)) { var document = openRpcGenerator.GetDocument(info, documentName, host.Uri); await WriteJson(httpContext.Response, document); } else { httpContext.Response.StatusCode = 404; } }