Baqend not working with Fusetools

I’m trying to use the service with Fusetools.

I had to modify some parts of the baqend.js to make it work with Fusetools. The changes were required because Fusetools does not support window.sessionStorage but it has a shim for window.localStorage so i just changed the sessionStorage to localStorage.

Besides that in different places it tries to access the browser window api but as Fuse doesn’t support it I had to change those parts as well. i.e I made the isChrome variable to False by default, similarly I changed
if (secure === undefined) { secure = window.location.protocol == ‘https:’; }


if (secure === undefined) { secure = false; }

and this line: xhr.upload.onprogress = message.progress(); to this xhr.onprogress = message.progress();

The problem is that the token is not being saved in the localStorage>

These changes made it successfully work on local preview on MacOS and iOS but doesn’t work on Android.

I hope we can find a solution for it.


We use different JS backends on ios and android. It’s impossible to know what the problem might be without an error message. Have you tried to hook up the debugger?

Okay, finally fixed it. The issue was with XMLHttpRequest polyfill. i changed the getResponseHeader function from:

fuseXMLHttpRequest.prototype.getResponseHeader = function(header) {
	if(this._fuseHttpRequest === null) return;
	return this._fuseHttpRequest.getResponseHeader(header);

to :

fuseXMLHttpRequest.prototype.getResponseHeader = function(header) {
	if(this._fuseHttpRequest === null) return;
	if (!!this._fuseHttpRequest.getResponseHeader(header)){
		return this._fuseHttpRequest.getResponseHeader(header);
	} else {
		var heads = this._fuseHttpRequest.getResponseHeaders();
		var lines = heads.split("\n");
		var item = null;
			if (line.indexOf(":")>-1){
				var keyvals=line.split(":");
				if (keyvals[0].toLowerCase()==header.toLowerCase())
		return item;

It works now.

Do you have any details on what the problem with getResponseHeader was?

getResponseHeader function was returning null values for every key provided, even though the values were there.

So I checked the getAllResponseHeaders function and it returned the header values slightly different on Android compared to iOS and local preview.

On local preview it the string returned from getAllResponseHeaders was :

Cache-Control: private, max-age=60
Content-Type: application/json; charset=UTF-8
ETag: "z310lWMuyVlLKwsM6g8txw=="
Age: 0
Accept-Ranges: bytes,bytes
Content-Length: 6786
Date: Fri, 28 Apr 2017 17:16:15 GMT
X-Served-By: cache-hhn1543-HHN
X-Cache-Hits: 0
X-Timer: S1493399775.415924,VS0,VE5
Vary: Accept, Accept-Encoding
X-Cache: MISS from gateway
Via: 1.1 varnish-v4, 1.1 varnish, 1.1 gateway (squid/3.5.19)
Connection: keep-alive

while on Android it returned in this format:

Cache-Control:public, max-age=60
Vary:Accept, Accept-Encoding
X-Android-Response-Source:NETWORK 200
X-Cache:MISSMISS from gateway
Via:1.1 varnish-v4, 1.1 varnish, 1.1 gateway (squid/3.5.19)
Content-Type:application/json; charset=UTF-8
Date:Fri, 28 Apr 2017 17:14:05 GMT
null:HTTP/1.1 200 OK

The main thing i noticed was the spacing between the colons between keys and values, which does not exist in the Android version. I think that was the reason the getResponseHeader function couldn’t parse it. So i did manual parsing of the string in getResponseHeader shown in my previous post, and it worked.

Thank you, I have raised a ticket to get this fixed.