Skip to content

Commit 948db2f

Browse files
committed
Send content-length header in method responses
- 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.
1 parent d9c88c4 commit 948db2f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/server.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ function Server(options, isSecure, onListening) {
4747
else {
4848
xml = Serializer.serializeMethodResponse(value)
4949
}
50-
response.writeHead(200, {'Content-Type': 'text/xml'})
50+
response.writeHead(200, {
51+
'Content-Type': 'text/xml',
52+
'Content-Length': Buffer.byteLength(xml, 'utf8')
53+
})
5154
response.end(xml)
5255
})
5356
}

0 commit comments

Comments
 (0)