@@ -21,7 +21,8 @@ public async Task<IActionResult> SetAsync([FromBody] ProxyInfo proxyInfo)
21
21
{
22
22
if ( proxyInfo . ConfigFile != null )
23
23
{
24
- return BadRequest ( "ConfigFile cannot be set" ) ;
24
+ ModelState . AddModelError ( "ConfigFile" , "ConfigFile cannot be set" ) ;
25
+ return ValidationProblem ( ModelState ) ;
25
26
}
26
27
27
28
if ( proxyInfo . Recording . HasValue )
@@ -39,7 +40,7 @@ public async Task<IActionResult> SetAsync([FromBody] ProxyInfo proxyInfo)
39
40
return Ok ( ProxyInfo . From ( _proxyState ) ) ;
40
41
}
41
42
42
- [ HttpPost ( "raiseMockRequest " ) ]
43
+ [ HttpPost ( "mockRequest " ) ]
43
44
public async Task RaiseMockRequestAsync ( )
44
45
{
45
46
await _proxyState . RaiseMockRequestAsync ( ) ;
@@ -53,12 +54,18 @@ public void StopProxy()
53
54
_proxyState . StopProxy ( ) ;
54
55
}
55
56
56
- [ HttpPost ( "createJwtToken " ) ]
57
+ [ HttpPost ( "jwtToken " ) ]
57
58
public IActionResult CreateJwtToken ( [ FromBody ] JwtOptions jwtOptions )
58
59
{
59
60
if ( jwtOptions . SigningKey != null && jwtOptions . SigningKey . Length < 32 )
60
61
{
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 ) ;
62
69
}
63
70
64
71
var token = JwtTokenGenerator . CreateToken ( jwtOptions ) ;
0 commit comments