Comments (12)
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.
Yes, I will update them today and give you an update.
from http_interceptor.
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.
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.
Thanks, that's great news (and also fast in my opinion)! Do you also plan on migrating to null-safety soon?
from http_interceptor.
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.
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.
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.
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.
Yes, that makes complete sense and I probably missed it while migrating to null safety, will send a patch release soon π
from http_interceptor.
Thank you :)
from http_interceptor.
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)
- interceptResponse, missing response headers HOT 2
- Migration guide link links to 404 HOT 1
- Adding the possibility to add a generic request timeout handler HOT 4
- Exclude specific calls from being intercepted/retried -- HeaderSanitizerContract proposal HOT 9
- Unhandled Exception: FormatException: Unexpected extension byte (at offset 1) HOT 3
- Retry Policy with delay HOT 6
- headers are not getting updated upon retry HOT 13
- How to test http client with interceptor? TimeoutException after ... Future not completed HOT 7
- HandshakeException HOT 8
- It is possible to decode all responses to UTF-8 using interceptResponse? HOT 7
- Body is set to empty string when it should be null HOT 4
- Using interceptors on multipart request HOT 9
- Ability to edit Response body in interceptor HOT 5
- How to use with WebSockets HOT 1
- Upgrade http dependency to 1.0.0 HOT 2
- Problem while logging request and response HOT 7
- type 'Response' is not a subtype of type 'StreamedResponse' in type cast
- refreshToken called multiple times HOT 1
- How should i handle shouldInterceptRequest when you have interceptRequest HOT 1
- Cancel http request HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from http_interceptor.