Is there a way to increase the number of redirects in postman? Or correct this error?
I get this error when I run a POST request. The value of attempts is 150 in the code. But in Postman it seems to stop at 9.
Error: Exceeded maxRedirects. Probably stuck in a redirect loop https://url_here.com/api/Search/WaitUntilDone?taskId=8bf016fd-690a-4884-9baa-f1bea73f7c85&attempt=9
Code:
public async Task WaitUntilDone([FromQuery] Guid taskId, [FromQuery] int attempt = 0)
{
var response = new SearchCaseResponse();
var task = await TaskContext.GetTaskAsync<SearchCaseTask>(taskId);
if (task.Completed == null && attempt < 150)
{
await Task.Delay(TimeSpan.FromSeconds(1));
attempt = attempt + 1;
return RedirectToActionPreserveMethod(actionName: "WaitUntilDone", routeValues: new
{
taskId = task.TaskId.Value,
attempt = attempt
});
}
else if (task.Completed == null && attempt >= 150)
{
response.Error = "Search request has timed out";
return Ok(response);
}
response.Error = task.Error;
response.CaseList = task.ResultCaseList?.Select(x=>x.ToResponseDto()).ToList();
response.ResultSource = task.ResultSource;
return Ok(response);
}
Body:
{
“region”: “gastage”,
“location”: “rockdale:sca”,
“firstName”: “ABC”,
“lastName”: “EFG”,
“bName”: “GA DHS”,
“search”:true
}
Details (like screenshots):