cnnlabs / cnn-hapi

CNN Hapi
10 stars 4 forks source link

Adding checks around response.header #14

Closed adslaton closed 8 years ago

adslaton commented 8 years ago

Why

Addresses https://github.com/cnnlabs/cnn-hapi/issues/13

Adding checks to prevent this error

Debug: internal, implementation, error 
    TypeError: Uncaught error: request.response.header is not a function
    at setCacheControlHeaders (/home/ubuntu/workspace/main.js:63:26)
    at server.route.server.ext.method (/home/ubuntu/workspace/main.js:189:13)
    at /home/ubuntu/workspace/node_modules/hapi/lib/request.js:402:22
    at iterate (/home/ubuntu/workspace/node_modules/hapi/node_modules/items/lib/index.js:36:13)
    at done (/home/ubuntu/workspace/node_modules/hapi/node_modules/items/lib/index.js:28:25)
    at Function.wrapped [as _next] (/home/ubuntu/workspace/node_modules/hoek/lib/index.js:867:20)
    at Function.internals.Reply.interface.internals.continue (/home/ubuntu/workspace/node_modules/hapi/lib/reply.js:107:10)
    at server.ext.method (/home/ubuntu/workspace/lib/plugins/metrics/index.js:16:34)
    at /home/ubuntu/workspace/node_modules/hapi/lib/request.js:402:22
    at iterate (/home/ubuntu/workspace/node_modules/hapi/node_modules/items/lib/index.js:36:13)