Example #1
0
        /// <inheritdoc />
        public Task TransportAsync(CancellationToken cancellationToken = default)
        {
            HttpResponseUtilities.AddNecessaryContents(_httpContextAccessor.HttpContext, "text/html");

            var form = HtmlFormBuilder.CreateForm(_url, _formData);

            return(_httpContextAccessor.HttpContext.Response.WriteAsync(form, cancellationToken));
        }
Example #2
0
        /// <inheritdoc />
        public Task TransportAsync(CancellationToken cancellationToken = default)
        {
            if (Descriptor.Type == GatewayTransporterDescriptor.TransportType.Post)
            {
                HttpResponseUtilities.AddNecessaryContents(_httpContext, "text/html");

                var form = HtmlFormBuilder.CreateForm(Descriptor.Url, Descriptor.Form);

                return(_httpContext.Response.WriteAsync(form, cancellationToken));
            }

            HttpResponseUtilities.AddNecessaryContents(_httpContext);

            _httpContext.Response.Redirect(Descriptor.Url);

            return(Task.CompletedTask);
        }
        /// <inheritdoc />
        public virtual Task TransportAsync(CancellationToken cancellationToken = default)
        {
            if (Descriptor.Type == GatewayTransporterDescriptor.TransportType.Post)
            {
                HttpResponseUtilities.AddNecessaryContents(_httpContext, "text/html");

                var form = HtmlFormBuilder.CreateForm(Descriptor.Url, Descriptor.Form);

                var buffer = Encoding.UTF8.GetBytes(form);

                return(_httpContext.Response.Body.WriteAsync(buffer, 0, buffer.Length, cancellationToken));
            }

            HttpResponseUtilities.AddNecessaryContents(_httpContext);

            _httpContext.Response.Redirect(Descriptor.Url);

            return(Task.CompletedTask);
        }