I am doing Unit Test using wiremock for the batch ...
# general
s
I am doing Unit Test using wiremock for the batch request in .net core 3.0, wiremock version is 1.5.34 below code i have used to find which is main request in the body of batch, but while using ansync(req)=>{}); getting error as "Cannot convert lambda expression to type IResponseProvide because it is not a delegate type" sample code is
var server = WireMockServer.Start();
server .Given(Request.Create().WithPath("/$batch").UsingPost()) .AtPriority(1) .RespondWith(async (req) => { var batchContent = await req.BodyData.BodyAsMultipartAsync(); // Parse multipart batch request var batchResponseBuilder = Response.Create(); foreach (var part in batchContent.Parts) { var queryResponse = await ReadResponseFromJsonFile("response_query1.json"); // Read response from JSON file batchResponseBuilder.WithTransformer() .Append($"--batchBoundary") .Append("Content-Type: application/http") .Append("Content-Transfer-Encoding: binary") .Append("") .Append($"HTTP/1.1 200 OK") .Append($"Content-Type: application/json") .Append("") .Append(queryResponse); } batchResponseBuilder .Append($"--batchBoundary--") .WithStatusCode(200) .WithHeader("Content-Type", $"multipart/mixed; boundary=batchBoundary"); return batchResponseBuilder; });
o
I recommend asking in #wiremock-dotnet
👍 1