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

Minor changes to HttpCallAssertion #483

Closed
tmenier opened this issue Dec 10, 2019 · 3 comments
Closed

Minor changes to HttpCallAssertion #483

tmenier opened this issue Dec 10, 2019 · 3 comments

Comments

@tmenier
Copy link
Owner

tmenier commented Dec 10, 2019

With #481, where fake responses can be set up for requests that meet specific conditions, fluent methods for setting up those conditions began to very closely resemble methods used in call assertions (WithVerb, WithQueryParam, etc.). This revealed a couple omissions and less-than-ideal method signatures in HttpCallAssertion that will be fixed for 3.0. Specifically:

BREAKING changes:

  • WithQueryParamValue(name, value) will be replaced by the existing WithQueryParam(name) by adding an optional value parameter.
  • WithoutQueryParamValue(name, value) will be replaced by the existing WithoutQueryParam(name) by adding an optional value parameter.
  • WithQueryParamValues(object) and WithoutQueryParamValues(object) will be renamed WithQueryParams and WithoutQueryParams, respectively.

Additions and non-breaking changes:

  • WithVerb will have an overload that takes a string.
  • WithVerb overloads will allow multiple verbs (params); assert will pass on any match.
  • WithAnyQueryParam(params string[]) to assert any of a list of query parameter names was passed, or any query parameter at all if no list is provided.
@LazloBodi
Copy link

LazloBodi commented Jan 13, 2020

I'am noticing a breaking change regarding to this:
I make a get call in a method to like http://test.com/api?account=testAccount
Previously (dotnetcore 2.2, and flurl 2.8.2) this test was working for it:
HttpTest .ShouldHaveCalled("http://test.com/api") .WithVerb(HttpMethod.Get) .WithQueryParam("account", "testAccount");
Now only this is working:
HttpTest .ShouldHaveCalled("http://test.com/api?account=testAccount") .WithVerb(HttpMethod.Get);

@tmenier
Copy link
Owner Author

tmenier commented Jan 13, 2020

@LazloBodi That's actually related to #323. In short, you'll just need to put a * at the end of it if it might have a query string, i.e. .ShouldHaveCalled("http://test.com/api*").

@LazloBodi
Copy link

Yep, that was the problem. thanks for the help.

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

No branches or pull requests

2 participants