Skip to content

Instantly share code, notes, and snippets.

@cvazac
Created August 4, 2017 03:10
Show Gist options
  • Select an option

  • Save cvazac/01fda820a9bbfeba1c9409f43cae7432 to your computer and use it in GitHub Desktop.

Select an option

Save cvazac/01fda820a9bbfeba1c9409f43cae7432 to your computer and use it in GitHub Desktop.
const query = `
CREATE TEMPORARY FUNCTION getHeaders(payload STRING)
RETURNS STRING
LANGUAGE js AS """
try {
var $ = JSON.parse(payload);
var headers = $.response.headers;
var st = headers.find(function(e) {
return e['name'].toLowerCase() === 'server-timing'
});
return st['value'];
} catch (e) {
return '';
}
""";
SELECT * FROM
(SELECT url, getHeaders(payload) AS st FROM httparchive.har.2017_07_01_chrome_requests)
WHERE
st != ""
`
ReactDOM.render(
<HttpArchiveQuery query={query}><div>Hello, world</div></HttpArchiveQuery>,
document.getElementById('root')
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment