Code Monkey home page Code Monkey logo

Comments (5)

olleolleolle avatar olleolleolle commented on July 16, 2024

Hm, would it be possible to use URI::Generic's https://rubyapi.org/2.5/o/uri/generic#method-i-check_opaque

from faraday.

iMacTia avatar iMacTia commented on July 16, 2024

Apologies about that @pharmaceutics.
I've checked the code and indeed Utils.URI can be configured to use other parsers as well, but in this scenario we need to call opaque which is not a very standard method.

I don't like this open-ended configurability, since we don't have a way to enforce that the configured parser returns an object that behaves exactly like a URI, but I'm happy to change this to bring back compatibility as it was before.

Just as a curiosity, why do you override the default_uri_parser?

from faraday.

iMacTia avatar iMacTia commented on July 16, 2024

@pharmaceutics PR with a fix is merged and released as v2.7.4 👍

I'd still be interested to hear about your use-case to use Addressable::URI as a parser, if possible 🙏

from faraday.

pharmaceutics avatar pharmaceutics commented on July 16, 2024

@iMacTia thanks a lot! The actual parser in the code looked like this

Faraday::Utils.default_uri_parser = -> (v) { Addressable::URI.parse(v).normalize }

and two use cases I see tested are handling IDNAs and path parts with invalid characters that both wouldn't normally work (for example, with Addressable https://はじめよう.みんな/some|path is automatically encoded as https://xn--p8j9a0d9c9a.xn--q9jyb4c/some%7Cpath)
But there's probably no real reason why the URL couldn't be normalized separately first, with Faraday getting an already encoded version that would work with the regular Kernel#URI

from faraday.

iMacTia avatar iMacTia commented on July 16, 2024

Thanks @pharmaceutics, it doesn't seem like an extremely useful feature and it does create some maintainance issues, so it's likely we'll remove it on the next major version.

from faraday.

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.