#3135 - Add request duration to response details
This commit is contained in:
@@ -207,8 +207,14 @@ export const executeRequest = (req) => ({fn, specActions, specSelectors}) => {
|
||||
|
||||
specActions.setRequest(req.pathName, req.method, parsedRequest)
|
||||
|
||||
// track duration of request
|
||||
const startTime = Date.now()
|
||||
|
||||
return fn.execute(req)
|
||||
.then( res => specActions.setResponse(req.pathName, req.method, res))
|
||||
.then( res => {
|
||||
res.duration = Date.now() - startTime
|
||||
specActions.setResponse(req.pathName, req.method, res)
|
||||
} )
|
||||
.catch( err => specActions.setResponse(req.pathName, req.method, { error: true, err: serializeError(err) } ) )
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user