public async Task BuildAsync(IEntityBuilder builder) { var descriptor = this._endpointDescriptorProvider.GetEndpointDescriptor(this._captureExpression, this._claimsPrincipal); if (descriptor == null) { await Task.CompletedTask; return; } if (descriptor.Body != null) { throw new InvalidOperationException("Cannot add link, body is not null!"); } if (descriptor.Method != "GET") { throw new InvalidOperationException("Cannot add link, method is not GET!"); } var href = this._hrefFactory.MakeHref(descriptor); builder.WithLink(new Link(this._name, href, this._rel)); }