{"action":"created","issue":{"url":"https://api.github.com/repos/brainhubeu/hadron/issues/8","repository_url":"https://api.github.com/repos/brainhubeu/hadron","labels_url":"https://api.github.com/repos/brainhubeu/hadron/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/brainhubeu/hadron/issues/8/comments","events_url":"https://api.github.com/repos/brainhubeu/hadron/issues/8/events","html_url":"https://github.com/brainhubeu/hadron/issues/8","id":323099647,"number":8,"title":"Empty object in response","user":{"login":"Lukasz-pluszczewski","id":19817661,"avatar_url":"https://avatars3.githubusercontent.com/u/19817661?v=4","gravatar_id":"","url":"https://api.github.com/users/Lukasz-pluszczewski","html_url":"https://github.com/Lukasz-pluszczewski","followers_url":"https://api.github.com/users/Lukasz-pluszczewski/followers","following_url":"https://api.github.com/users/Lukasz-pluszczewski/following{/other_user}","gists_url":"https://api.github.com/users/Lukasz-pluszczewski/gists{/gist_id}","starred_url":"https://api.github.com/users/Lukasz-pluszczewski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lukasz-pluszczewski/subscriptions","organizations_url":"https://api.github.com/users/Lukasz-pluszczewski/orgs","repos_url":"https://api.github.com/users/Lukasz-pluszczewski/repos","events_url":"https://api.github.com/users/Lukasz-pluszczewski/events{/privacy}","received_events_url":"https://api.github.com/users/Lukasz-pluszczewski/received_events","type":"User","site_admin":false},"labels":[{"id":908256174,"url":"https://api.github.com/repos/brainhubeu/hadron/labels/bug","name":"bug","color":"d73a4a","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-15T07:35:53Z","updated_at":"2018-05-15T08:40:50Z","closed_at":null,"author_association":"MEMBER","body":"Hadron returns strings correctly, but when I return object in callback I always get empty object in the response.\r\n\r\nHadron configuration:\r\n```javascript\r\nhadron(\r\n  app,\r\n  [\r\n    require('@brainhubeu/hadron-express'),\r\n  ],\r\n  {\r\n    routes,\r\n  },\r\n))\r\n```\r\n\r\nRoute:\r\n```javascript\r\n{\r\n  getPost: {\r\n    path: '/posts/:id',\r\n    methods: ['GET'],\r\n    callback: () => {\r\n      return {\r\n        title: 'Some title',\r\n        content: 'Some content goes here',\r\n        tags: [\r\n          'one',\r\n          'two',\r\n          'three',\r\n          4,\r\n        ],\r\n      };\r\n    },\r\n    middleware: [],\r\n  },\r\n}\r\n```\r\n\r\nPostman:\r\n<img width=\"983\" alt=\"screen shot 2018-05-15 at 09 33 23\" src=\"https://user-images.githubusercontent.com/19817661/40042884-154c6b28-5823-11e8-8d61-a6d7657cd062.png\">\r\n\r\n\r\nNode version: 10.1.0\r\nNPM version: 6.0.1\r\nHadron-core version: 0.0.2\r\nHadron-express version: 0.0.2"},"comment":{"url":"https://api.github.com/repos/brainhubeu/hadron/issues/comments/389089953","html_url":"https://github.com/brainhubeu/hadron/issues/8#issuecomment-389089953","issue_url":"https://api.github.com/repos/brainhubeu/hadron/issues/8","id":389089953,"user":{"login":"Lukasz-pluszczewski","id":19817661,"avatar_url":"https://avatars3.githubusercontent.com/u/19817661?v=4","gravatar_id":"","url":"https://api.github.com/users/Lukasz-pluszczewski","html_url":"https://github.com/Lukasz-pluszczewski","followers_url":"https://api.github.com/users/Lukasz-pluszczewski/followers","following_url":"https://api.github.com/users/Lukasz-pluszczewski/following{/other_user}","gists_url":"https://api.github.com/users/Lukasz-pluszczewski/gists{/gist_id}","starred_url":"https://api.github.com/users/Lukasz-pluszczewski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lukasz-pluszczewski/subscriptions","organizations_url":"https://api.github.com/users/Lukasz-pluszczewski/orgs","repos_url":"https://api.github.com/users/Lukasz-pluszczewski/repos","events_url":"https://api.github.com/users/Lukasz-pluszczewski/events{/privacy}","received_events_url":"https://api.github.com/users/Lukasz-pluszczewski/received_events","type":"User","site_admin":false},"created_at":"2018-05-15T08:40:50Z","updated_at":"2018-05-15T08:40:50Z","author_association":"MEMBER","body":"This seems to be the intentional behavior:\r\nYou can return primitive value (like string, number null or undefined) and it will be sent as body. But to send JSON you need to return object with this interface:\r\n```\r\ninterface IResponseSpec {\r\n  status?: StatusCode;\r\n  redirect?: string;\r\n  headers?: IHeaders;\r\n  body?: any;\r\n  view?: IView;\r\n}\r\n```\r\n\r\nPlease, confirm if this was intended, and you can close this issue."}}
{"actor":{"display_login":"Lukasz-pluszczewski"}}