Skip to content

Commit 5b4b71b

Browse files
author
hpinkos
committed
Fixes #6206
1 parent fd7fbfd commit 5b4b71b

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Change Log
55

66
##### Fixes :wrench:
77
* Fixed bug where AxisAlignedBoundingBox did not copy over center value when cloning an undefined result. [#6183](https://github.com/AnalyticalGraphicsInc/cesium/pull/6183)
8+
* Fixed `Resource.fetch` when called with no arguments [#6206](https://github.com/AnalyticalGraphicsInc/cesium/issues/6206)
89

910
### 1.42.1 - 2018-02-01
1011
_This is an npm-only release to fix an issue with using Cesium in Node.js.__

Source/Core/Resource.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,7 @@ define([
11031103
* @see {@link http://wiki.commonjs.org/wiki/Promises/A|CommonJS Promises/A}
11041104
*/
11051105
Resource.prototype.fetch = function(options) {
1106-
options = defaultClone(options, defaultValue.EMPTY_OBJECT);
1106+
options = defaultClone(options, {});
11071107
options.method = 'GET';
11081108

11091109
return makeRequest(this, options);

Specs/Core/ResourceSpec.js

+19
Original file line numberDiff line numberDiff line change
@@ -589,4 +589,23 @@ defineSuite([
589589
expect(Resource.prototype.fetch).toHaveBeenCalled();
590590
});
591591
});
592+
593+
it('fetch calls correct method', function() {
594+
var expectedUrl = 'http://test.com/endpoint';
595+
var expectedResult = {
596+
status: 'success'
597+
};
598+
599+
spyOn(Resource._Implementations, 'loadWithXhr').and.callFake(function(url, responseType, method, data, headers, deferred, overrideMimeType) {
600+
expect(url).toEqual(expectedUrl);
601+
expect(method).toEqual('GET');
602+
deferred.resolve(expectedResult);
603+
});
604+
605+
var resource = new Resource({url: expectedUrl});
606+
return resource.fetch()
607+
.then(function(result) {
608+
expect(result).toEqual(expectedResult);
609+
});
610+
});
592611
});

0 commit comments

Comments
 (0)