fix failing test resulting from overlapping async calls

This commit is contained in:
Jesse MacFadyen
2015-05-11 17:47:08 -07:00
parent 65eea291b2
commit f1e41ac1f5
+5 -6
View File
@@ -377,6 +377,11 @@ namespace WPCordovaClassLib.Cordova.Commands
webRequest.ContentType = "multipart/form-data; boundary=" + Boundary;
webRequest.Method = uploadOptions.Method;
DownloadRequestState reqState = new DownloadRequestState();
InProcDownloads[uploadOptions.Id] = reqState;
reqState.options = uploadOptions;
reqState.request = webRequest;
// Associate cookies with the request
// This is an async call, so we need to await it in order to preserve proper control flow
await CopyCookiesFromWebBrowser(webRequest);
@@ -393,12 +398,6 @@ namespace WPCordovaClassLib.Cordova.Commands
}
}
DownloadRequestState reqState = new DownloadRequestState();
reqState.options = uploadOptions;
reqState.request = webRequest;
InProcDownloads[uploadOptions.Id] = reqState;
webRequest.BeginGetRequestStream(uploadCallback, reqState);
}
catch (Exception /*ex*/)