Coder Social home page Coder Social logo

Comments (5)

geefinator avatar geefinator commented on August 23, 2024

Just to update, as you will notice I was allowing the bad requests to save as objects on the api. I went ahead an threw a 400 if the data was empty, and sure enough as I expected, the http-client ignored the 400 and came back with the 201 (of the good request with the proper data).

from http-client.

zewa666 avatar zewa666 commented on August 23, 2024

Hi there,

I've created a Unit Test to check whether it's an API issue. Seems not to be so. Here is the code if you wan't to check it yourself:

      it('should make only one request (Issue #25)', () => {
        var content = { name: "A demo name" };
        var client = new HttpClient()
          .configure(x => {
            x.withBaseUrl(baseUrl);
            x.withHeader('Content-Type', 'application/json');
          });

        client.post('some/cool/path', content);
        expect(jasmine.Ajax.requests.count()).toBe(1);
      });

So I guess it's related to something specific to your application. Dunno maybe you're calling the method by incident a second time or so. Just add a breakpoint to your addOrganization() method to see if it's executed twice.

from http-client.

geefinator avatar geefinator commented on August 23, 2024

The addOrganization() function is only being called upon a form submittal. So unless the form is being submitted twice, I am not sure how my application would be making double requests. Just the behavior of the two requests really seems like a bug somewhere. One was completely silent as far as dev tools was concerned, the other was not. I will take a look again at my code, but it really is dead simple whats going on.

from http-client.

geefinator avatar geefinator commented on August 23, 2024

And now it seems to no longer be doing it at all. shrug. I did do some refactoring of all that code so i suppose I must of been doing something whacky previously. Thanks for taking the time to write up a test case for my own error :)

from http-client.

zewa666 avatar zewa666 commented on August 23, 2024

No problem at all. Glad it got solved

from http-client.

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.