GithubHelp home page GithubHelp logo

Comments (12)

CodingAleCR avatar CodingAleCR commented on May 19, 2024 9

Hi, just an update. Since version 0.13.0 of http includes a couple of breaking changes I have to change a bit the way the interceptors work so... The bad news is that it'll take me a bit more, but the good news is that I can have it ready by Saturday without faults.

I apologize for the inconveniences this may be causing to your work or anyone else's. πŸ™πŸΌπŸ˜”

from http_interceptor.

CodingAleCR avatar CodingAleCR commented on May 19, 2024 8

Yes, I will update them today and give you an update.

from http_interceptor.

CodingAleCR avatar CodingAleCR commented on May 19, 2024 6

You're the best haha. Although I already have a local branch done as well, just testing it out to avoid adding breaking changes. Thanks a lot Sebastian and I will definitely check it out to see if there's something I missed that you already have.

Also, this weekend I've reflected upon the future of the plugin, I will release stable 1.0.0 really soon but it will include a couple of breaking changes so I'm trying to set out the foundations for that side. I'm happy that you took interest and will reach out once I'm done if you want to check it out.

from http_interceptor.

sesha-codeprism avatar sesha-codeprism commented on May 19, 2024 2

No problem at all mate, you can take your time and do it at your convenience. No inconvenience as such, it's just that I can't update to latest packages, that's all.

You want/need more time, I'm a-okay with it.

Will be waiting for the update..Thanks a lot for the hard work mate!

from http_interceptor.

p0wl90 avatar p0wl90 commented on May 19, 2024 1

Thanks, that's great news (and also fast in my opinion)! Do you also plan on migrating to null-safety soon?

from http_interceptor.

CodingAleCR avatar CodingAleCR commented on May 19, 2024 1

Thanks, that's great news (and also fast in my opinion)! Do you also plan on migrating to null-safety soon?

Yes, the update will include null safety and hopefully proper web support.

from http_interceptor.

basti1253 avatar basti1253 commented on May 19, 2024 1

Hi there,

first of all thank you very much for all the time you've spent on creating and maintaining this lib.

I've forked and updated your code base to sound null safety. I've made quite a few changes so I don't know if you like my approach. E.g. I've replaced effective_dart by pedantic and dropped support for using Strings as URIs as there's no union type in dart.

If you want me to create a PR, just give me a ping. It's still utterly untested, but I'll include it within my app by tomorrow and update that to sound null safety as well.

You could try it yourself by changing your pubspec like this:

  http_interceptor:
    git:
      url: https://github.com/basti1253/http_interceptor
      ref: master

This repository hopefully won't exist very long, so don't rely on it ;)

kind regards and all the best

Sebastian

from http_interceptor.

basti1253 avatar basti1253 commented on May 19, 2024 1

Nice! Thank you very mich for the update!
May I suggest a slight change in the code base? As a consumer of the library it'd be easier if RequestData params and headers are not nullable.

like:

 class RequestData {
   Method method;
   String baseUrl;
-  Map<String, String>? headers;
-  Map<String, String>? params;
+  Map<String, String> headers;
+  Map<String, String> params;
   dynamic? body;
   Encoding? encoding;
 
   RequestData({
     required this.method,
     required this.baseUrl,
-    this.headers,
-    this.params,
+    Map<String, String>? headers,
+    Map<String, String>? params,
     this.body,
     this.encoding,
-  });
+  })  : headers = headers ?? {},
+        params = params ?? {};
 
   String get url => buildUrlString(baseUrl, params);
 
@@ -45,7 +46,7 @@ class RequestData {
 
     Request request = new Request(methodToString(method), reqUrl.toUri());
 
-    if (headers != null) request.headers.addAll(headers!);
+    request.headers.addAll(headers);

Just a little more comfort as the consumer doesn't need to initialize headers/params.

At the moment my request interceptor looks like this:

  @override
  Future<RequestData> interceptRequest({
    required RequestData data,
  }) async {
    var jwt = await this.getToken();
    if (jwt.isEmpty) {
      throw UnauthorizedException('no token found');
    }
    data.headers = data.headers ?? {};
    data.headers!['Authorization'] = 'Bearer $jwt';
    return data;
  }

from http_interceptor.

CodingAleCR avatar CodingAleCR commented on May 19, 2024

Hi, this should be solved once 0.4.0 is published, please take a look at the migration guide in order to fix any issues caused by the update. Here's the PR with the changes as well if you are curious as well: #57

from http_interceptor.

CodingAleCR avatar CodingAleCR commented on May 19, 2024

Yes, that makes complete sense and I probably missed it while migrating to null safety, will send a patch release soon πŸ˜‰

from http_interceptor.

basti1253 avatar basti1253 commented on May 19, 2024

Thank you :)

from http_interceptor.

CodingAleCR avatar CodingAleCR commented on May 19, 2024

You are very welcome. Let me know if there's other ideas you might have or needs you think we could cover with the library. Also, feel free to checkout our roadmap πŸ™ŒπŸΌ

from http_interceptor.

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.