Skip to content

Commit 28cfb8e

Browse files
authored
Merge pull request #104 from umbraco/feature/zapier-response-types
Handle invalid access as Unauthorized
2 parents 4301fbc + cf60452 commit 28cfb8e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Umbraco.Forms.Integrations.Automation.Zapier/Api/Management/Controllers/GetFormPropertiesByIdController.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ public GetFormPropertiesByIdController(IUserValidationService userValidationServ
1717

1818
[HttpGet("forms/{id}")]
1919
[ProducesResponseType(typeof(List<Dictionary<string, string>>), StatusCodes.Status200OK)]
20+
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
2021
public IActionResult GetFormPropertiesById(string id)
2122
{
2223
var emptyList = new List<Dictionary<string, string>>();
2324

24-
if (!IsAccessValid()) return Ok(emptyList);
25+
if (!IsAccessValid())
26+
return Unauthorized();
2527

2628
var form = ZapierFormService.GetById(id);
2729

src/Umbraco.Forms.Integrations.Automation.Zapier/Api/Management/Controllers/GetFormsController.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ public GetFormsController(IUserValidationService userValidationService, ZapierFo
1818

1919
[HttpGet("forms")]
2020
[ProducesResponseType(typeof(IEnumerable<FormDto>), StatusCodes.Status200OK)]
21+
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
2122
public IActionResult GetForms()
2223
{
23-
if (!IsAccessValid()) return Ok(Enumerable.Empty<FormDto>());
24+
if (!IsAccessValid())
25+
return Unauthorized();
2426

2527
return Ok(ZapierFormService.GetAll());
2628
}

0 commit comments

Comments
 (0)