Giter Club home page Giter Club logo

Comments (3)

aloisdeniel avatar aloisdeniel commented on June 30, 2024 1

Thank you ! Will add it to the repo ! :)

from http_extensions.

aloisdeniel avatar aloisdeniel commented on June 30, 2024

After looking a little bit into it, what is your use case ?

The only advantage over using directly resolve on the sent URI to me would be query parameters in global options that would be sent with every request. But that's enough for making an extension. :)

var response = await client.getWithOptions('my-url-string', 
    options: [RequestOptions(queryParameters: {'option1': 'value1'}]);

Seems more complex than :

var response = await client.get(
Uri.parse('my-url-string').replace(queryParameters: {'option1': 'value1'}));

But for this use case it may be useful :

 final client = ExtendedClient(
    inner: Client(),
    extensions: [
      QueryExtension( 
         defaultOptions: QueryOptions(queryParameters: {'option1': 'value1'}),
      ),
    ],
  );

var response = await client.get('my-url-string'); // => "my-url-string?option1=value1"

But this usecase is a bad web-api design IMO, recurrent parameters should be passed in headers instead (which gives me a new extension idea :) )

from http_extensions.

jamiewest avatar jamiewest commented on June 30, 2024

I think I was just trying to abstract away some of the Uri code somewhere else. But I agree, it is simpler to just use Uri code in the method. :)

from http_extensions.

Related Issues (5)

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.