fix to prevent data corruption when using xhr with chunked data

fixes #921

In the handleRequest method the data is of type Buffer (not string), and gets corrupted when the data is split in several parts.

Added test cases at the end of of xhr polling tests.