(#2880) - fix base64-encoded attachments in http.js

The http adapter is not correctly handling base64-encoded
strings in putAttachment(). Instead of correctly recognizing
the text as base64, it actually just stores it as-is.

This also adds a test to ensure that we throw an error
if the user supplies a string that is not base64-encoded.