Giter VIP home page Giter VIP logo

Comments (3)

tmenier avatar tmenier commented on August 29, 2024

I'm not sure if I'm following. Any value set explcitly on HttpTest.Settings should always override the same setting set anywhere in the SUT. That's by design. But when not explicitly set on HttpTest.Settings, it should respect the settings specified in the SUT. In your code above, I confirmed that the settings specified at the start are in effect when you make the call further down. Am I missing something?

from flurl.

arch-imp avatar arch-imp commented on August 29, 2024

I've updated the title to hopefully help clarify.

When I run this test, the call ".WithRequestJson(requestDto)" fails. Reason being is the json serializer set on the FlurlClientCache is using camel case. Hence, the serialized json used in the body of the call is {"property":"Value"}. In the call to WithRequestJson, the serializer used to serialize requestDto is not the same as what is set earlier. As a result, WithRequestJson is using pascal case, and is comparing {"Property":"Value"} to the body of the call. Note the uppercase "Property" vs lowercase "property".

{"Property":"Value"} is not the same as {"property":"Value"}

Assertion message:
Flurl.Http.Testing.HttpTestException: Expected any calls to be made with URL pattern http://test.com and body {"Property":"Value"}, but no matching calls were made.

Stack Trace: 
HttpCallAssertion.Assert(Nullable1 count) HttpCallAssertion.With(Func2 match, String descrip)
HttpCallAssertion.WithRequestBody(String bodyPattern)
HttpCallAssertion.WithRequestJson(Object body)
FlurlTests.TheTest() line 36

from flurl.

tmenier avatar tmenier commented on August 29, 2024

Got it. I probably should have ran your test before replying. :) Sounds legitimate, it's been added to the backlog and I'll look into when I get some time.

from flurl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.