expressjs / response-time

Response time header for node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

response-time does not contain data about url of request.

Xrave opened this issue · comments

Hey,
I was using response-time as a methodology to obtain metric on all the node module accesses and the server time used by each call. In order for ease of access, the handler that processes response-time is embedded into load event handler for all XMLHTTPRequests.
However, the XMLHTTPRequests implementation lacks information about which URL the response came from, which was strange.
I'm suggesting that response-time return a JSON object like thus:
this.setHeader('X-Response-Time', '{"url":"'+req.url+'","time":"'+ ms.toFixed(digits) + '"}');
Would this be more preferable or am I approaching this the wrong way?

Would this be more preferable or am I approaching this the wrong way?

No. You need to do that mapping on the client-side for whatever technology you are using to make the AJAX requests. How to do that is beyond the scope of this issue tracker. I recommend asking on somewhere like Stackoverflow.com about how to map request URLs to response headers for AJAX requests.