Skip to content

3rd party XHR request still intercepted in spite of passthrough #1320

@allthesignals

Description

@allthesignals

May be related to #285, the 3rd party lib I'm using is MapboxGL.

Here are all my passthroughs:

  this.passthrough('https://raw.githubusercontent.com/**');
  this.passthrough('http://raw.githubusercontent.com/**');
  this.passthrough('https://tiles.planninglabs.nyc/**');
  this.passthrough('http://tiles.planninglabs.nyc/**');

Console just throws AJAXError {status: 200}

image

After setting up breakpoints, the actual response 3rd party lib gets from pretender is undefined:

ajax.getJSON(request, function (error, json) { } // error = AJAXError {status: 200}, json = undefined

I'm not sure where this problem is coming from. One of the requests, https://raw.githubusercontent.com/NYCPlanning/labs-gl-style/master/data/style.json, gives strange errors when you try to visit it directly. I'm not sure if the headers are confusing pretender in someway. Any ideas?

Full stacktrace
server.js:22 Passthrough request: GET //raw.githubusercontent.com/NYCPlanning/labs-gl-style/master/data/style.json
server.js:28 Mirage: [200] GET /api/sources
mapbox-gl-dev.js:40253 AJAXError {status: 200}status: 200__proto__: Error
fire @ mapbox-gl-dev.js:40253
(anonymous) @ mapbox-gl-dev.js:27330
xhr.onload @ mapbox-gl-dev.js:39705
(anonymous) @ fake_xml_http_request.js:137
dispatchEvent @ fake_xml_http_request.js:181
dispatchEvent @ pretender.js:216
xhr.(anonymous function) @ pretender.js:226
load (async)
createHandler @ pretender.js:224
createPassthrough @ pretender.js:242
send @ pretender.js:166
exports.getJSON @ mapbox-gl-dev.js:39708
loadURL @ mapbox-gl-dev.js:27328
setStyle @ mapbox-gl-dev.js:37965
Map @ mapbox-gl-dev.js:37369
_setup @ mapbox-gl.js:49
invoke @ backburner.js:205
flush @ backburner.js:125
flush @ backburner.js:278
end @ backburner.js:410
_run @ backburner.js:760
_join @ backburner.js:736
join @ backburner.js:477
run.join @ ember-metal.js:4366
(anonymous) @ ember-metal.js:4441
mightThrow @ jquery.js:3534
process @ jquery.js:3602
setTimeout (async)
(anonymous) @ jquery.js:3640
fire @ jquery.js:3268
fireWith @ jquery.js:3398
fire @ jquery.js:3406
fire @ jquery.js:3268
fireWith @ jquery.js:3398
ready @ jquery.js:3878
completed @ jquery.js:3888
mapbox-gl-dev.js:40253 AJAXError {status: 200}
fire @ mapbox-gl-dev.js:40253
(anonymous) @ mapbox-gl-dev.js:27330
xhr.onload @ mapbox-gl-dev.js:39705
dispatchEvent @ pretender.js:218
xhr.(anonymous function) @ pretender.js:226
load (async)
createHandler @ pretender.js:224
createPassthrough @ pretender.js:242
send @ pretender.js:166
exports.getJSON @ mapbox-gl-dev.js:39708
loadURL @ mapbox-gl-dev.js:27328
setStyle @ mapbox-gl-dev.js:37965
Map @ mapbox-gl-dev.js:37369
_setup @ mapbox-gl.js:49
invoke @ backburner.js:205
flush @ backburner.js:125
flush @ backburner.js:278
end @ backburner.js:410
_run @ backburner.js:760
_join @ backburner.js:736
join @ backburner.js:477
run.join @ ember-metal.js:4366
(anonymous) @ ember-metal.js:4441
mightThrow @ jquery.js:3534
process @ jquery.js:3602
setTimeout (async)
(anonymous) @ jquery.js:3640
fire @ jquery.js:3268
fireWith @ jquery.js:3398
fire @ jquery.js:3406
fire @ jquery.js:3268
fireWith @ jquery.js:3398
ready @ jquery.js:3878
completed @ jquery.js:3888

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions