Skip to content

Commit edb6f46

Browse files
Updates API
1 parent 447a524 commit edb6f46

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

dev-proxy/ApiControllers/ProxyController.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ public async Task<IActionResult> SetAsync([FromBody] ProxyInfo proxyInfo)
2121
{
2222
if (proxyInfo.ConfigFile != null)
2323
{
24-
return BadRequest("ConfigFile cannot be set");
24+
ModelState.AddModelError("ConfigFile", "ConfigFile cannot be set");
25+
return ValidationProblem(ModelState);
2526
}
2627

2728
if (proxyInfo.Recording.HasValue)
@@ -39,7 +40,7 @@ public async Task<IActionResult> SetAsync([FromBody] ProxyInfo proxyInfo)
3940
return Ok(ProxyInfo.From(_proxyState));
4041
}
4142

42-
[HttpPost("raiseMockRequest")]
43+
[HttpPost("mockRequest")]
4344
public async Task RaiseMockRequestAsync()
4445
{
4546
await _proxyState.RaiseMockRequestAsync();
@@ -53,12 +54,18 @@ public void StopProxy()
5354
_proxyState.StopProxy();
5455
}
5556

56-
[HttpPost("createJwtToken")]
57+
[HttpPost("jwtToken")]
5758
public IActionResult CreateJwtToken([FromBody] JwtOptions jwtOptions)
5859
{
5960
if (jwtOptions.SigningKey != null && jwtOptions.SigningKey.Length < 32)
6061
{
61-
return BadRequest("The specified signing key is too short. A signing key must be at least 32 characters.");
62+
var problemDetails = new ProblemDetails
63+
{
64+
Title = "Key too short",
65+
Detail = "The specified signing key is too short. A signing key must be at least 32 characters.",
66+
Status = StatusCodes.Status400BadRequest
67+
};
68+
return BadRequest(problemDetails);
6269
}
6370

6471
var token = JwtTokenGenerator.CreateToken(jwtOptions);

0 commit comments

Comments
 (0)