Merge branch 'master' into bug/3072-error-response-fixes
This commit is contained in:
@@ -9,7 +9,7 @@ const primitives = {
|
||||
"number": () => 0,
|
||||
"number_float": () => 0.0,
|
||||
"integer": () => 0,
|
||||
"boolean": () => true
|
||||
"boolean": (schema) => typeof schema.default === "boolean" ? schema.default : true
|
||||
}
|
||||
|
||||
const primitive = (schema) => {
|
||||
|
||||
@@ -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