lundi 17 avril 2017

AS3: Sending empty Content-Type header in urlrequestHeader

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.

Aucun commentaire:

Enregistrer un commentaire