Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where to get the request content length from #3

Open
TheBestMoshe opened this issue Apr 28, 2020 · 2 comments
Open

Where to get the request content length from #3

TheBestMoshe opened this issue Apr 28, 2020 · 2 comments

Comments

@TheBestMoshe
Copy link

When initialized like the readme, the content size is not reported to Firebase.
I've figured out how to set the response content length

    final performanceInterceptor = DioFirebasePerformanceInterceptor(
        responseContentLengthMethod: (Response response) {
      return int.parse(response.headers['content-length'][0]);
    });

There is also a parameter requestContentLengthMethod, however how do I get the content longth of the request. I'm not seing anything in the RequestOptions object. Do we need to somehow calculate this on our own?

@fvisticot
Copy link

When initialized like the readme, the content size is not reported to Firebase.
I've figured out how to set the response content length

    final performanceInterceptor = DioFirebasePerformanceInterceptor(
        responseContentLengthMethod: (Response response) {
      return int.parse(response.headers['content-length'][0]);
    });

There is also a parameter requestContentLengthMethod, however how do I get the content longth of the request. I'm not seing anything in the RequestOptions object. Do we need to somehow calculate this on our own?

Any news on this question ?

@vishna
Copy link
Contributor

vishna commented Nov 2, 2020

@TheBestMoshe @fvisticot this is the current implementation:

https://github.com/eyeem/dio_firebase_performance/blob/master/lib/src/dio_firebase_performance.dart#L67

I presume this is the best you can do with existing Dio API - you can provide your own implementation as an argument to interceptor.

If you have an idea for better implementation I'll gladly welcome a PR :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants