mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-29 13:21:50 +02:00
AllowOnlyDefinedHttpStatusCodeInResponse (#422)
This commit is contained in:
@@ -40,7 +40,7 @@ namespace WireMock.Owin
|
||||
|
||||
bool? AllowBodyForAllHttpMethods { get; set; }
|
||||
|
||||
bool? AllowAnyHttpStatusCodeInResponse { get; set; }
|
||||
bool? AllowOnlyDefinedHttpStatusCodeInResponse { get; set; }
|
||||
|
||||
bool? DisableJsonBodyParsing { get; set; }
|
||||
}
|
||||
|
||||
@@ -104,12 +104,12 @@ namespace WireMock.Owin.Mappers
|
||||
|
||||
private int MapStatusCode(int code)
|
||||
{
|
||||
if (_options.AllowAnyHttpStatusCodeInResponse == true || Enum.IsDefined(typeof(HttpStatusCode), code))
|
||||
if (_options.AllowOnlyDefinedHttpStatusCodeInResponse == true && !Enum.IsDefined(typeof(HttpStatusCode), code))
|
||||
{
|
||||
return code;
|
||||
return (int)HttpStatusCode.OK;
|
||||
}
|
||||
|
||||
return (int)HttpStatusCode.OK;
|
||||
return code;
|
||||
}
|
||||
|
||||
private bool IsFault(ResponseMessage responseMessage)
|
||||
|
||||
@@ -43,8 +43,8 @@ namespace WireMock.Owin
|
||||
/// <inheritdoc cref="IWireMockMiddlewareOptions.AllowBodyForAllHttpMethods"/>
|
||||
public bool? AllowBodyForAllHttpMethods { get; set; }
|
||||
|
||||
/// <inheritdoc cref="IWireMockMiddlewareOptions.AllowAnyHttpStatusCodeInResponse"/>
|
||||
public bool? AllowAnyHttpStatusCodeInResponse { get; set; }
|
||||
/// <inheritdoc cref="IWireMockMiddlewareOptions.AllowOnlyDefinedHttpStatusCodeInResponse"/>
|
||||
public bool? AllowOnlyDefinedHttpStatusCodeInResponse { get; set; }
|
||||
|
||||
/// <inheritdoc cref="IWireMockMiddlewareOptions.DisableResponseBodyParsing"/>
|
||||
public bool? DisableJsonBodyParsing { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user