/// <summary>Creates an <see cref="HttpResponseMessage"/> asynchronously.</summary>
        /// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
        /// <returns>A task that, when completed, contains the <see cref="HttpResponseMessage"/>.</returns>
        public async Task <HttpResponseMessage> ExecuteAsync(CancellationToken cancellationToken)
        {
            var message = await _result.ExecuteAsync(cancellationToken);

            message.Headers.Location = Location;
            return(message);
        }
Beispiel #2
0
        /// <summary>Creates an <see cref="HttpResponseMessage"/> asynchronously.</summary>
        /// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
        /// <returns>A task that, when completed, contains the <see cref="HttpResponseMessage"/>.</returns>
        public async Task <HttpResponseMessage> ExecuteAsync(CancellationToken cancellationToken)
        {
            string link = UrlFactory.Link(RouteName, RouteValues);

            var message = await _result.ExecuteAsync(cancellationToken);

            message.Headers.Location = new Uri(link);
            return(message);
        }
Beispiel #3
0
        /// <summary>Creates an <see cref="HttpResponseMessage"/> asynchronously.</summary>
        /// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
        /// <returns>A task that, when completed, contains the <see cref="HttpResponseMessage"/>.</returns>
        public async Task <HttpResponseMessage> ExecuteAsync(CancellationToken cancellationToken)
        {
            var result = new JSendResult <FailResponse>(StatusCode, Response, Request);

            var message = await result.ExecuteAsync(cancellationToken);

            foreach (var challenge in Challenges)
            {
                message.Headers.WwwAuthenticate.Add(challenge);
            }

            return(message);
        }
Beispiel #4
0
        /// <summary>Creates an <see cref="HttpResponseMessage"/> asynchronously.</summary>
        /// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
        /// <returns>A task that, when completed, contains the <see cref="HttpResponseMessage"/>.</returns>
        public Task <HttpResponseMessage> ExecuteAsync(CancellationToken cancellationToken)
        {
            var result = new JSendResult <SuccessResponse>(StatusCode, SuccessResponse, _dependencies.RequestMessage);

            return(result.ExecuteAsync(cancellationToken));
        }
 /// <summary>Creates an <see cref="HttpResponseMessage"/> asynchronously.</summary>
 /// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
 /// <returns>A task that, when completed, contains the <see cref="HttpResponseMessage"/>.</returns>
 public Task <HttpResponseMessage> ExecuteAsync(CancellationToken cancellationToken)
 => _result.ExecuteAsync(cancellationToken);
Beispiel #6
0
        /// <summary>Creates an <see cref="HttpResponseMessage"/> asynchronously.</summary>
        /// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
        /// <returns>A task that, when completed, contains the <see cref="HttpResponseMessage"/>.</returns>
        public Task <HttpResponseMessage> ExecuteAsync(CancellationToken cancellationToken)
        {
            var result = new JSendResult <ErrorResponse>(StatusCode, Response, Request);

            return(result.ExecuteAsync(cancellationToken));
        }