问题
I want to download file from dropbox api. Below is the snippet of my code.
var oauthHeader:URLRequestHeader = OAuthHelper.buildRequestHeaderWithToken(config.accessTokenKey);
var urlRequest:URLRequest = new URLRequest();
var jsonPath:String = JSON.stringify(params);
var requestHeader:URLRequestHeader = new URLRequestHeader("Dropbox-API-Arg",jsonPath);
urlRequest.requestHeaders = [oauthHeader,requestHeader];
urlRequest.contentType = "";
urlRequest.method = httpMethod;
urlRequest.url = url;
I get the following error when making request.
Error in call to API function "files/download": You provided a non-empty HTTP "Content-Type" header ("application/x-www-form-urlencoded"). This API function requires that the header be missing or empty.
How can I send empty 'Content-Type' header.
回答1:
I found the way. The correct way to send the empty content-type header is to put a space in a value.
new URLRequestHeader("Content-Type", " ");
if you don't put a space and send empty string it will give you the error.
来源:https://stackoverflow.com/questions/43448733/as3-sending-empty-content-type-header-in-urlrequestheader