mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-27 19:27:42 +02:00
Enrich generated code with status code (#927)
This commit is contained in:
@@ -125,6 +125,11 @@ internal class MappingConverter
|
|||||||
// Response
|
// Response
|
||||||
sb.AppendLine(" .RespondWith(Response.Create()");
|
sb.AppendLine(" .RespondWith(Response.Create()");
|
||||||
|
|
||||||
|
if (response.ResponseMessage.StatusCode is { } statusCode)
|
||||||
|
{
|
||||||
|
sb.AppendLine($" .WithStatusCode({statusCode})");
|
||||||
|
}
|
||||||
|
|
||||||
if (response.ResponseMessage.Headers is { })
|
if (response.ResponseMessage.Headers is { })
|
||||||
{
|
{
|
||||||
foreach (var header in response.ResponseMessage.Headers)
|
foreach (var header in response.ResponseMessage.Headers)
|
||||||
|
|||||||
@@ -7,5 +7,6 @@ server
|
|||||||
)
|
)
|
||||||
.WithGuid("90356dba-b36c-469a-a17e-669cd84f1f05")
|
.WithGuid("90356dba-b36c-469a-a17e-669cd84f1f05")
|
||||||
.RespondWith(Response.Create()
|
.RespondWith(Response.Create()
|
||||||
|
.WithStatusCode(200)
|
||||||
.WithBody("1")
|
.WithBody("1")
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ server
|
|||||||
)
|
)
|
||||||
.WithGuid("90356dba-b36c-469a-a17e-669cd84f1f05")
|
.WithGuid("90356dba-b36c-469a-a17e-669cd84f1f05")
|
||||||
.RespondWith(Response.Create()
|
.RespondWith(Response.Create()
|
||||||
|
.WithStatusCode(200)
|
||||||
.WithBody("1")
|
.WithBody("1")
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -18,6 +19,7 @@ server
|
|||||||
)
|
)
|
||||||
.WithGuid("1b731398-4a5b-457f-a6e3-d65e541c428f")
|
.WithGuid("1b731398-4a5b-457f-a6e3-d65e541c428f")
|
||||||
.RespondWith(Response.Create()
|
.RespondWith(Response.Create()
|
||||||
|
.WithStatusCode(201)
|
||||||
.WithHeader("hk", "hv")
|
.WithHeader("hk", "hv")
|
||||||
.WithBody("2")
|
.WithBody("2")
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user