While updating dependencies I ran into an issue going from version 0.4.1 --> 0.5.0.
It looks like in the latest version in the acceptHandler it requires that responses contain a body. Where as previous versions did not require a body, is this an intended change?
Root Cause
This line in particular is assuming if there is a response that there is a body nested within that response, and if there is not a body in the response, the body variable is set to null or undefined
var body = response ? response.body : {}
and then the body gets here and then fails
Object.keys(body).forEach(function (type) {
Problem
/Users/jlofton/Desktop/goBalto/bloodhound/node_modules/osprey-method-handler/osprey-method-handler.js:167
Object.keys(body).forEach(function (type) {
^
TypeError: Cannot convert undefined or null to object
at Function.keys (<anonymous>)
at /Users/jlofton/Desktop/goBalto/bloodhound/node_modules/osprey-method-handler/osprey-method-handler.js:167:14
at Array.forEach (<anonymous>)
at acceptsHandler (/Users/jlofton/Desktop/goBalto/bloodhound/node_modules/osprey-method-handler/osprey-method-handler.js:163:6)
at ospreyMethodHandler (/Users/jlofton/Desktop/goBalto/bloodhound/node_modules/osprey-method-handler/osprey-method-handler.js:127:21)
at /Users/jlofton/Desktop/goBalto/bloodhound/node_modules/osprey/lib/server.js:30:12
at /Users/jlofton/Desktop/goBalto/bloodhound/node_modules/osprey-resources/osprey-resources.js:58:20
at Array.forEach (<anonymous>)
Suggested Fix
The previous version of this line works
var body = response && response.body || {}
Again not sure if this is an intended change or not, thanks!
While updating dependencies I ran into an issue going from version 0.4.1 --> 0.5.0.
It looks like in the latest version in the acceptHandler it requires that responses contain a body. Where as previous versions did not require a body, is this an intended change?
Root Cause This line in particular is assuming if there is a response that there is a body nested within that response, and if there is not a body in the response, the body variable is set to null or undefined
and then the body gets here and then fails
Problem
Suggested Fix The previous version of this line works
Again not sure if this is an intended change or not, thanks!