Git Product home page Git Product logo

Comments (7)

ronwsmith avatar ronwsmith commented on August 17, 2024

That config option manipulates the GET query string for the cache.

I think the fix you're looking for would be in the cache key generation here: https://github.com/oesmith/puffing-billy/blob/master/lib/billy/cache.rb#L80.

Seems like you want to remove keys from the request body before using the body to generate the cache key.

Want to take a stab at adding a new config option for that?

from puffing-billy.

michaelrkn avatar michaelrkn commented on August 17, 2024

Actually, all of these parameters are in the URL. The gem uses Faraday for the requests, so I'm guessing putting the parameters in the URL is part of Faraday's implementation. Is this unusual? If so, is it too unusual to justify adding support for removing nested keys?

from puffing-billy.

ronwsmith avatar ronwsmith commented on August 17, 2024

@michaelrkn, whoa, Balanced Payments sends credit card details in the GET query string? That violates nearly every rule about when to use a GET. I haven't seen nested GET params in a very long time and have reservations about helping enable Balanced Payments' poor architecture if that's indeed the case.

from puffing-billy.

michaelrkn avatar michaelrkn commented on August 17, 2024

Because the balanced.js library uses JSONP, it creates an async <script> tag to send the information and execute the callback:

function jsonp(path, callback) {
    var funct = "balanced_jsonp_" + Math.random().toString().substr(2);
    var tag = document.createElement("script");
    tag.type = "text/javascript";
    tag.async = true;
    tag.src = path.replace("{callback}", funct);
    var where = document.getElementsByTagName("script")[0];
    where.parentNode.insertBefore(tag, where);
    window[funct] = function(result) {
        try {
            callback(result);
        } catch (e) {
            if (typeof console !== "undefined" && console.error) {
                console.error(e);
            }
        }
        tag.parentNode.removeChild(tag);
    };
}

So, yes, it is performing a GET request, but that's because it's using JSONP. Honestly, I didn't actually understand how JSONP until doing a bit of research just now, but this seems to be the standard way to make requests with JSONP.

from puffing-billy.

ronwsmith avatar ronwsmith commented on August 17, 2024

@michaelrkn, is this still an issue? I see that the related issue in your repo was closed in June.

from puffing-billy.

michaelrkn avatar michaelrkn commented on August 17, 2024

We switched from Balanced to Stripe and no longer need to ignore nested keys. I have no idea if Puffing Billy supports this now, but my feelings won't be hurt if you decide this isn't important and close the issue :)

from puffing-billy.

ronwsmith avatar ronwsmith commented on August 17, 2024

I'll close it for now until another Balanced user runs into the same issue.

from puffing-billy.

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.