using System.Net.Http.Headers;
using Elsa.Extensions;
using Elsa.Http.ContentWriters;
using Elsa.Workflows.Core.Attributes;
using Elsa.Workflows.Core.Models;
using Elsa.Workflows.Management.Models;
using Microsoft.AspNetCore.Http;
using HttpRequestHeaders = Elsa.Http.Models.HttpRequestHeaders;
namespace Elsa.Http;
///
/// Send an HTTP request.
///
[Activity("Elsa", "HTTP", "Send an HTTP request.", DisplayName = "HTTP Request", Kind = ActivityKind.Task)]
public class SendHttpRequest : Activity
{
[Input] public Input Url { get; set; } = default!;
///
/// The HTTP method to use when sending the request.
///
[Input(
Description = "The HTTP method to use when sending the request.",
Options = new[] { "GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS", "HEAD" },
DefaultValue = "GET",
UIHint = InputUIHints.Dropdown
)]
public Input Method { get; set; } = new("GET");
///
/// The content to send with the request. Can be a string, an object, a byte array or a stream.
///
[Input(Description = "The content to send with the request. Can be a string, an object, a byte array or a stream.")]
public Input