This adds a new extension method in HttpResponseMessageExtensions class which retrieves the workflow instance ID from the response. It also includes a HeaderNames class to maintain the consistency of header names used by the Elsa API.
14 lines
527 B
C#
14 lines
527 B
C#
using Elsa.Api.Client.Shared;
|
|
|
|
namespace Elsa.Api.Client.Extensions;
|
|
|
|
/// <summary>
|
|
/// Contains extension methods for the <see cref="HttpResponseMessage"/> class.
|
|
/// </summary>
|
|
public static class HttpResponseMessageExtensions
|
|
{
|
|
/// <summary>
|
|
/// Gets the workflow instance ID from the response.
|
|
/// </summary>
|
|
public static string? GetWorkflowInstanceId(this HttpResponseMessage response) => response.Headers.TryGetValues(HeaderNames.WorkflowInstanceId, out var values) ? values.FirstOrDefault() : default;
|
|
} |