Add Status and Message to CreateOutResCommand
CreateOutResCommand now includes optional Status and Message properties to capture additional result details. The HTTP response status code is recorded in Status when creating an output result in InvokeRecActionCommandHandler.
This commit is contained in:
@@ -8,6 +8,10 @@ public class CreateOutResCommand : IRequest
|
||||
{
|
||||
public required long ActionId { get; set; }
|
||||
|
||||
public short? Status { get; set; }
|
||||
|
||||
public string? Message { get; set; }
|
||||
|
||||
public string? Header { get; set; }
|
||||
|
||||
public string? Body { get; set; }
|
||||
|
||||
@@ -54,8 +54,11 @@ public class InvokeRecActionCommandHandler(
|
||||
var resBody = await response.Content.ReadAsStringAsync(cancel);
|
||||
var resHeaders = response.Headers.ToDictionary();
|
||||
|
||||
var statusCode = (short)response.StatusCode;
|
||||
|
||||
await sender.Send(new CreateOutResCommand
|
||||
{
|
||||
Status = statusCode,
|
||||
ActionId = action.Id,
|
||||
Header = JsonSerializer.Serialize(resHeaders, options: new() { WriteIndented = false }),
|
||||
Body = resBody,
|
||||
|
||||
Reference in New Issue
Block a user