xhr.get('/api/chat/channel/' + encodedGroupName + '/messages?limit=' + limit + '&offset=' + offset, { json: true, headers: { 'Content-Type': 'application/json' } }, function (err, resp) { if (err || resp.body.error) { me.events.fire('history-error', resp.rawRequest); return; } me._on_group_history_recvd(grp, resp.body); });