Code Monkey home page Code Monkey logo

Comments (3)

alexlafroscia avatar alexlafroscia commented on July 30, 2024

I've run into that same problem myself, but I'm not sure how exactly to pull that off since technically .get is a valid API, just not for making requests.

We could look at overriding the .get method, checking against a whitelist of valid properties and sending that error if it doesn't match. However, then we have to keep that list up to date and I'm not sure it would play too nicely with the fact that we use an ES6 class under the hood.... So my inclination is that that wouldn't be a good solution.

@taras do you have any suggestions? As much as I think this would be a great thing to have, I'm just not sure how we would do it since .get is Ember's API

from ember-ajax.

taras avatar taras commented on July 30, 2024

@alexlafroscia we could overload get method and check for how many arguments are passed. If we detect that the user is using get as GET then throw a warning into the console. We won't be able to check in situation when someone does this.get('/someResource') but it's better than nothing.

What do you think?

from ember-ajax.

alexlafroscia avatar alexlafroscia commented on July 30, 2024

Yeah, that seems like a good compromise. We could even try to catch instances where the parameter to .get starts with a / to attempt warning about that use case as well.

I'm wondering how implementation would go, since the ES6 class is converted into a Mixin and then applied to the Service that way. I'll mess around with it tonight or tomorrow and see what I can do.

Other than the warning, what should the behavior be? Still proxy through to Ember's .get method, or should we actually throw an error to really draw attention to it?

from ember-ajax.

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.