NBomber.Http icon indicating copy to clipboard operation
NBomber.Http copied to clipboard

Response.Message is lost

Open askrinnik opened this issue 2 years ago • 0 comments

Hi.

Here is my C# code example.

var request = Http.CreateRequest(method, endpoint)
              .WithHeader("Accept", "application/json")
              .WithBody(content)
              .WithCheck(async (response) =>
              {
                var responseMsg = await response.Content.ReadAsStringAsync();
                if (response.StatusCode == statuscode)
                    return Response.Ok(statusCode: (int?)response.StatusCode, payload: responseMsg, message: "Created");
                else
                    return Response.Fail(statusCode: (int?)response.StatusCode, error: responseMsg);
              });
var response = await Http.Send(request, context);

I call Response.Ok(..., message: "Created") in the WithCheck lambda. But the final response returned by Http.Send() contains the empty string in the Message property. I believe the root cause of the issue is here: https://github.com/PragmaticFlow/NBomber.Http/blob/dev/src/NBomber.Http/Http.fs#L87 The Message property is not passed into Response.ok()

Could you fix it? Thank you in advance

askrinnik avatar Oct 20 '22 13:10 askrinnik