Moved common headers outside the method switch. Fixed a bug with multipart file uploads.