Commit 8d9cc915 authored by Jérome Perrin's avatar Jérome Perrin Committed by Eteri

sql_browser: set a server timing header to publish query time

https://w3c.github.io/server-timing/#the-server-timing-header-field
parent 233c6890
from decimal import Decimal
import datetime
import time
import json
from DateTime import DateTime
response = container.REQUEST.RESPONSE
start = time.time()
try:
results = context.manage_test(query)
data = [ results.names() ]
......@@ -31,5 +32,6 @@ for line in data[1:]:
new_line.append(v)
new_data.append(new_line)
response.setHeader("Server-Timing", "db=%s;" % (time.time() - start))
response.setHeader('Content-Type', 'application/json')
return json.dumps(new_data, indent=2)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment