I'm making a call to an external service using the Zend Http client. The service allows me to upload files to their storage system. It requires relevant params (userid, etc.) to be sent in the query string, and the file upload content should be sent in the POST body with a content-type of "application/zip" (I'm sending it a zip file with various things in it).
To do this, I set the params in the query string using the zend client's setParameterGet() function. I then set the file upload content using the setFileUpload() function:
$this->client->setFileUpload($zipFilePath, 'content', null, 'application/zip');
However, the service is telling me that I'm sending it the wrong content type, which is "multipart/form-data"
Here are the raw headers that the Zend client is sending to the service (note that I've removed bits of sensitive information, replacing them with item names enclosed in [] brackets)
POST https://[ServiceURL]?cmd=[COMMAND]&enrollmentid=[ENROLLMENTID]&itemid=[ITEMID]
HTTP/1.1
Host: [HOST] Accept-encoding: gzip, deflate
User-Agent: Zend_Http_Client Cookie:
AZT=9cMFAIBgG-eM1K|Bw7Qxlw7pBuPJwm0PCHryD;
Content-Type: multipart/form-data; boundary=---ZENDHTTPCLIENT-05535ba63b5130ab41d9c75859f678d8
Content-Length: 2967
-----ZENDHTTPCLIENT-05535ba63b5130ab41d9c75859f678d8
Content-Disposition: form-data; name="content"; filename="agilixContent.zip"
Content-Type: application/zip
[RAW FILE DATA HERE]
So basically, even though I've set the POST content type header, my external service is telling me I've sent the wrong content type, because there is another content-type header with the value "multipart/form-data". I've tried changing/removing that content header, but to no avail. How can I remove that header so that I won't have these two duplicate "content-type" headers in my requests?