Skip to content

Commit

Permalink
Send content-length header in method responses
Browse files Browse the repository at this point in the history
- unlike method calls (client), method responses (server) did not yet
  send content-length headers. This was causing problem with at least
  one client (ros's turtlesim, in the context of rosnodejs: publishing
  to /turtlt1/cmd_vel had no effect on the turtle). This commit fixes
  that.
  • Loading branch information
chfritz committed Oct 19, 2016
1 parent d9c88c4 commit 948db2f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ function Server(options, isSecure, onListening) {
else {
xml = Serializer.serializeMethodResponse(value)
}
response.writeHead(200, {'Content-Type': 'text/xml'})
response.writeHead(200, {
'Content-Type': 'text/xml',
'Content-Length': Buffer.byteLength(xml, 'utf8')
})
response.end(xml)
})
}
Expand Down

0 comments on commit 948db2f

Please sign in to comment.