From e2ffabbf7ff4d899532067955d7368019ea4ddc2 Mon Sep 17 00:00:00 2001 From: Matt Shull Date: Wed, 4 Jul 2018 17:27:21 -0500 Subject: [PATCH] fix rt query parameter and rt new data format --- src/index.js | 3 +-- src/mappers/har.js | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index 37b9c1e..c92a371 100644 --- a/src/index.js +++ b/src/index.js @@ -689,9 +689,8 @@ function parseData (request, state) { state.body = state.body.substr(5); } - state.body = decodeURIComponent(state.body); - if (request.headers['content-type'] === 'text/plain') { + state.body = decodeURIComponent(state.body); return JSON.parse(state.body); } diff --git a/src/mappers/har.js b/src/mappers/har.js index 8e137e2..5e94662 100644 --- a/src/mappers/har.js +++ b/src/mappers/har.js @@ -26,6 +26,8 @@ var packageInfo = require('../../package.json'), url = require('url'), querystring = require('querystring'); +var ResourceTimingDecompression = require("resourcetiming-compression").ResourceTimingDecompression; + module.exports = { initialise: function (/*options*/) { // Asynchronously update the user agent database. @@ -52,7 +54,7 @@ function map (data, referer, userAgent) { // HACK: The title must be set by the client with BOOMR.addVar(), // otherwise we fall back to using the page URL. pages: getPages(data, data.title || referer), - entries: getEntries(data.restiming) + entries: ResourceTimingDecompression.decompressResources(JSON.parse(data.restiming)) } }); }