-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(android): fix onprogress payload value for data other than HashMap (
#11168) request's length was not accounted for data of type different from HashMap, thus not reporting the progress properly in the callback Fixes TIMOB-27293
- Loading branch information
1 parent
a59cf84
commit a190a5d
Showing
2 changed files
with
59 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Appcelerator Titanium Mobile | ||
* Copyright (c) 2011-Present by Appcelerator, Inc. All Rights Reserved. | ||
* Licensed under the terms of the Apache Public License | ||
* Please see the LICENSE included with this distribution for details. | ||
*/ | ||
/* eslint-env mocha */ | ||
/* eslint no-unused-expressions: "off" */ | ||
'use strict'; | ||
var should = require('./utilities/assertions'); | ||
|
||
describe('Titanium.Network.HTTPClient', function () { | ||
|
||
it('progress event', function (finish) { | ||
var progressVar = -1, | ||
file = Titanium.Filesystem.getFile('SplashScreen.png'), | ||
base64String = Ti.Utils.base64encode(file).toString(), | ||
xhr = Ti.Network.createHTTPClient({ | ||
onsendstream: function (e) { | ||
try { | ||
should(e.progress).be.above(0); | ||
should(e.progress).be.aboveOrEqual(progressVar); | ||
progressVar = e.progress; | ||
} catch (error) { | ||
finish(error); | ||
} | ||
}, | ||
onload: function () { | ||
finish(); | ||
} | ||
}); | ||
xhr.open('POST', 'https://httpbin.org/post'); | ||
xhr.send(base64String); | ||
}); | ||
|
||
}); |