mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-04-20 07:44:39 +08:00
@@ -117,15 +117,15 @@ public class UniversalFirebasePerfModule extends UniversalFirebaseModule {
|
||||
HttpMetric httpMetric = httpMetrics.get(id);
|
||||
|
||||
if (httpMetricConfig.containsKey("httpResponseCode")) {
|
||||
httpMetric.setHttpResponseCode(httpMetricConfig.getInt("httpResponseCode"));
|
||||
httpMetric.setHttpResponseCode((int) httpMetricConfig.getDouble("httpResponseCode"));
|
||||
}
|
||||
|
||||
if (httpMetricConfig.containsKey("requestPayloadSize")) {
|
||||
httpMetric.setRequestPayloadSize(httpMetricConfig.getInt("requestPayloadSize"));
|
||||
httpMetric.setRequestPayloadSize((int) httpMetricConfig.getDouble("requestPayloadSize"));
|
||||
}
|
||||
|
||||
if (httpMetricConfig.containsKey("responsePayloadSize")) {
|
||||
httpMetric.setResponsePayloadSize(httpMetricConfig.getInt("responsePayloadSize"));
|
||||
httpMetric.setResponsePayloadSize((int) httpMetricConfig.getDouble("responsePayloadSize"));
|
||||
}
|
||||
|
||||
if (httpMetricConfig.containsKey("responseContentType")) {
|
||||
|
||||
@@ -62,6 +62,19 @@ android.describe('perf()', () => {
|
||||
await httpMetric.stop();
|
||||
should.equal(await httpMetric.stop(), null);
|
||||
});
|
||||
|
||||
it('handles floating point numbers', async () => {
|
||||
const httpMetric = firebase.perf().newHttpMetric(aCoolUrl, 'POST');
|
||||
await httpMetric.start();
|
||||
const floatingPoint = 500.447553;
|
||||
|
||||
httpMetric.setHttpResponseCode(floatingPoint);
|
||||
httpMetric.setResponsePayloadSize(floatingPoint);
|
||||
httpMetric.setRequestPayloadSize(floatingPoint);
|
||||
|
||||
await Utils.sleep(100);
|
||||
await httpMetric.stop();
|
||||
});
|
||||
});
|
||||
|
||||
// describe('removeAttribute()', async () => {
|
||||
|
||||
Reference in New Issue
Block a user