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