fixed doRequest, some changes to test

Fixed doRequest(), also made some changes in test, looks like too much c & p from Microsoft test.

Fails with a fatal error now, due to Microsoft code that shouldn't be there I think.