Fix mock session for tests

HTTP body content is expected to be bytes, not unicode.
Merge mock session fix (thanks @jonashaag)