Skip to content

Commit 6a769ac

Browse files
author
Christian
committed
Replacing an anonymous object with a typed response
1 parent 2b3c0c9 commit 6a769ac

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/ServiceControl/MessageFailures/Api/EditFailedMessagesController.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class EditFailedMessagesController(
2727

2828
[Route("edit/{failedMessageId:required:minlength(1)}")]
2929
[HttpPost]
30-
public async Task<IActionResult> Edit(string failedMessageId, [FromBody] EditMessageModel edit)
30+
public async Task<ActionResult<EditRetryResponse>> Edit(string failedMessageId, [FromBody] EditMessageModel edit)
3131
{
3232
if (!settings.AllowMessageEditing)
3333
{
@@ -43,7 +43,7 @@ public async Task<IActionResult> Edit(string failedMessageId, [FromBody] EditMes
4343
logger.LogWarning("Cannot edit message {FailedMessageId} because it has already been edited", failedMessageId);
4444
// We return HTTP 200 even though the edit is being ignored. This is to keep the compatibility with older versions of ServicePulse.
4545
// Newer ServicePulse versions (starting with x.x) will handle the response's payload accordingly.
46-
return Ok(new { EditIgnored = true });
46+
return Ok(new EditRetryResponse { EditIgnored = true });
4747
}
4848

4949
var failedMessage = await store.ErrorBy(failedMessageId);
@@ -85,7 +85,7 @@ await session.SendLocal(new EditAndSend
8585
NewHeaders = edit.MessageHeaders
8686
});
8787

88-
return Accepted(new { EditIgnored = false });
88+
return Accepted(new EditRetryResponse { EditIgnored = false });
8989
}
9090

9191

@@ -148,4 +148,9 @@ public class EditMessageModel
148148

149149
public Dictionary<string, string> MessageHeaders { get; set; }
150150
}
151+
152+
public class EditRetryResponse
153+
{
154+
public bool EditIgnored { get; set; }
155+
}
151156
}

0 commit comments

Comments
 (0)