public async Task Invoke(HttpContext httpContext, OpenRpcGenerator openRpcGenerator)
        {
            var documentName = GetDocumentName(httpContext.Request);

            if (!string.IsNullOrEmpty(documentName))
            {
                await ReturnDocument(httpContext, openRpcGenerator, documentName);
            }
            else
            {
                await next(httpContext);
            }
        }
        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;
            }
        }