CB-6503 allow file uploads to be sent directly, rather than only as multipart form data

I've added a null check here -- headers is not necessarily populated by this point. (same on android)