Fix SendHttpRequestActivity response handling logic

This fixes a bug where the "unmatched status code" activity would be scheduled even if the returned status code was defined as an expected outcome.
This commit is contained in:
Sipke Schoorstra 2023-08-22 13:42:23 +02:00
parent 68a20de07f
commit 9416461f78

View file

@ -40,8 +40,14 @@ public class SendHttpRequest : SendHttpRequestBase
var expectedStatusCodes = ExpectedStatusCodes;
var statusCode = (int)response.StatusCode;
var matchingCase = expectedStatusCodes.FirstOrDefault(x => x.StatusCode == statusCode);
var activity = matchingCase?.Activity ?? UnmatchedStatusCode;
var activity = matchingCase != null ? matchingCase.Activity : UnmatchedStatusCode;
if(activity == null)
{
await context.CompleteActivityAsync();
return;
}
await context.ScheduleActivityAsync(activity, OnChildActivityCompletedAsync);
}