senecajs / seneca-transport

Seneca micro-services message transport over TCP and HTTP.
MIT License
63 stars 45 forks source link

transportUtils.error is not a function #63

Closed GlenTiki closed 8 years ago

GlenTiki commented 8 years ago

Found when cURLing this seneca http server listening on port 10201:

var Seneca = require('seneca')

var seneca = Seneca({ log: 'silent' })

seneca.add({ a: 1 }, function (input, done) {
  console.log(input)
  done(null, { b: 1, port: process.argv[2]  })
})

// eg. run with node ./test.js port
seneca.listen({ port: process.argv[2] })

curl example:

$ curl -d '{"a": 1, route: 0}' -H "Content-Type: application/json" http://localhost:10201/act
transportUtil.error is not a function: {"a": 1, route: 0}

Expected:

$ curl -d '{"a": 1, route: 0}' -H "Content-Type: application/json" http://localhost:10201/act
{"b":1,"port":"10201"}
geek commented 8 years ago

In this case, the content type specified is JSON, we should expect the content you pass to be valid JSON