       describe 'when invoked with "--header" option', () ->
 
         receivedRequest = {}
+        producedMediaType = 'application/vnd.api+json'
+        reqMediaType = undefined
 
         runHeaderTestAsync = (done) ->
-          extraHeader = 'Accept:application/json'
+          extraHeader = "Accept:#{reqMediaType}"
           ramlFile = "#{RAML_DIR}/single-get.raml"
           cmd = "#{ABAO_BIN} #{ramlFile} --server #{SERVER} --header #{extraHeader}"
 
           app = express()
 
+          app.use (req, res, next) ->
+            receivedRequest = req
+            next()
+
+          app.use (req, res, next) ->
+            err = null
+            produces = ["#{producedMediaType}"]
+            if !req.accepts produces
+              err = new Error('Not Acceptable')
+              err.status = 406
+            next(err)
+
           app.get '/machines', (req, res) ->
-            receivedRequest = req
             machine =
               type: 'bulldozer'
               name: 'willy'
-            res.status(200).json([machine])
+            res.setHeader 'Content-Type', "#{producedMediaType}"
+            res.status(200).send([machine])
+
+          app.use (err, req, res, next) ->
+            res.status(err.status || 500)
+              .json({
+                message: err.message,
+                stack: err.stack
+              })
+            return
 
           server = app.listen PORT, () ->
             execCommand cmd, () ->


      describe 'when invoked with "--generate-hooks" option', () ->

        describe 'by itself', () ->

          runGenHooksTestAsync = (done) ->
            ramlFile = "#{RAML_DIR}/single-get.raml"

stdout = ''
report = ''
exitStatus = null

#
# To dump individual raw test results:
