Skip to content

Commit a297819

Browse files
waldekmastykarzgarrytrinder
authored andcommitted
Updates API
1 parent 685678a commit a297819

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
@@ -23,7 +23,8 @@ public async Task<IActionResult> SetAsync([FromBody] ProxyInfo proxyInfo)
2323
{
2424
if (proxyInfo.ConfigFile != null)
2525
{
26-
return BadRequest("ConfigFile cannot be set");
26+
ModelState.AddModelError("ConfigFile", "ConfigFile cannot be set");
27+
return ValidationProblem(ModelState);
2728
}
2829

2930
if (proxyInfo.Recording.HasValue)
@@ -41,7 +42,7 @@ public async Task<IActionResult> SetAsync([FromBody] ProxyInfo proxyInfo)
4142
return Ok(ProxyInfo.From(_proxyState));
4243
}
4344

44-
[HttpPost("raiseMockRequest")]
45+
[HttpPost("mockRequest")]
4546
public async Task RaiseMockRequestAsync()
4647
{
4748
await _proxyState.RaiseMockRequestAsync();
@@ -55,12 +56,18 @@ public void StopProxy()
5556
_proxyState.StopProxy();
5657
}
5758

58-
[HttpPost("createJwtToken")]
59+
[HttpPost("jwtToken")]
5960
public IActionResult CreateJwtToken([FromBody] JwtOptions jwtOptions)
6061
{
6162
if (jwtOptions.SigningKey != null && jwtOptions.SigningKey.Length < 32)
6263
{
63-
return BadRequest("The specified signing key is too short. A signing key must be at least 32 characters.");
64+
var problemDetails = new ProblemDetails
65+
{
66+
Title = "Key too short",
67+
Detail = "The specified signing key is too short. A signing key must be at least 32 characters.",
68+
Status = StatusCodes.Status400BadRequest
69+
};
70+
return BadRequest(problemDetails);
6471
}
6572

6673
var token = JwtTokenGenerator.CreateToken(jwtOptions);

0 commit comments

Comments
 (0)