GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — requestUtils.get calls setRequestHeaders without the request as this · Issue #1245 · maxGraph/maxGraph Open DescriptionDescribe the bugWhen export const get = (url, onload = null, onerror = null, binary = false, timeout = null, ontimeout = null, headers = null) => { const req = new MaxXmlRequest(url, null, 'GET'); const { setRequestHeaders } = req; if (headers) { req.setRequestHeaders = (request, params) => { setRequestHeaders.apply(this, [request, params]); // ... Both ImpactThe default implementation of It breaks as soon as the method relies on To ReproduceThis Jest test, run in import { afterEach, beforeEach, describe, expect, jest, test } from '@jest/globals'; import { MaxXmlRequest, requestUtils } from '../../src'; describe('get', () => { beforeEach(() => { jest.spyOn(XMLHttpRequest.prototype, 'send').mockImplementation(() => {}); }); afterEach(() => { jest.restoreAllMocks(); }); test.each([ ['without headers', null], ['with headers', { Authorization: 'token xyz' }], ])('call setRequestHeaders on the request %s', (_description, headers) => { const setRequestHeadersSpy = jest.spyOn(MaxXmlRequest.prototype, 'setRequestHeaders'); const request = requestUtils.get( 'diagram.xml', null, null, false, null, null, headers ); expect(setRequestHeadersSpy).toHaveBeenCalledTimes(1); expect(setRequestHeadersSpy.mock.contexts[0]).toBe(request); }); }); The case without headers passes. The case with headers fails, Replacing Expected behaviorThe original setRequestHeaders.apply(req, [request, params]); This was working with mxGraph. Environment
Additional contextFound with the ActivityMetadataMetadataAssigneesLabelsNo labels TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |