Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add send api method so that entire request message configured #62

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dennisroche
Copy link

Add a Send implementation to IApi.

In my test setup, I have an extension method that builds the HttpRequestMethod using expressions. This removes the hardcoded routes from the tests and compile-time errors when action parameters change.

e.g.

scenario.When
    .Send(r => r.CreateRequest<ValuesController>(c => c.Post(new PostValues { Data = "payload" })));

for

[HttpPost]
public async Task<IActionResult> Post([FromBody] PostValues values)
{
    await Task.CompletedTask;
    return Ok();
}

/// </summary>
/// <param name="requestSetup">configure outgoing http request</param>
/// <returns>IResponse</returns>
IResponse Send(Action<HttpRequestMessage> requestSetup);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
IResponse Send(Action<HttpRequestMessage> requestSetup);
IResponse Send(HttpRequestMessage message);

Would that work? it's a bit simpler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants