assaf/node-replay

jsdom XMLHttpRequest reports no headers

justincy opened this issue · 0 comments

jsdom expects rawHeaders to be available. They are being generated internally but just not passed on. This can be fixed by adding rawHeaders: response.rawHeaders || [] to this block of code:

this.response = {
version: response.version || '1.1',
statusCode: response.statusCode && parseInt(response.statusCode, 10) || 200,
statusMessage: response.statusMessage || '',
headers: {},
body: response.body ? response.body.slice(0) : [],
trailers: {}
};