GithubHelp home page GithubHelp logo

Comments (4)

luisobo avatar luisobo commented on August 16, 2024

The problem may be related to URL normalization. Try adding a trailing
slash to the URL:
stubRequest(@"POST", @"https://example.com/foo/");

URL normalization is a big TODO.

If that's not it, can you please append a sample project so I can debug the
issue?

Thanks!

2013/7/1 Josh Brown [email protected]

I'm stubbing like this:

stubRequest(@"POST", @"https://example.com/foo");

And Nocilla is throwing an exception:

Terminating app due to uncaught exception 'NocillaUnexpectedRequest',
reason: 'An unexcepted HTTP request was fired.

Nocilla specifies (in the console) how to properly stub the request,
including the headers and body, but I'd expect it to work without having to
stub the headers and body. I've verified that the URL is indeed the same,
so now I'm stuck. Am I stubbing something incorrectly?


Reply to this email directly or view it on GitHubhttps://github.com//issues/44
.

from nocilla.

joshuatbrown avatar joshuatbrown commented on August 16, 2024

Tried and couldn't reproduce in my sample project, but it's still an issue in my actual project. Hmm...

from nocilla.

luisobo avatar luisobo commented on August 16, 2024

Is your tests waiting for the request to complete?

Check this scenario:

  1. You stub a request
  2. You fire the asynchronous request
  3. Your test finishes
  4. Stubs are cleared
  5. The async request finishes

The last two steps are in the wrong order. To avoid this you must prevent your test to finish by making it wait until the async request has finished:

  1. You stub a request
  2. You fire the asynchronous request
  3. Your test waits until the request finishes
  4. The async request finishes but
  5. Your test finishes
  6. Stubs are cleared

If you are using Kiwi, use [expectFutureValue(something) shouldEventually] ...

from nocilla.

joshuatbrown avatar joshuatbrown commented on August 16, 2024

I'm assuming you're right - that I'm not waiting for the response. Thanks!

from nocilla.

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.