diff --git a/test/main.js b/test/main.js index 550e4f4..f0e0fd8 100644 --- a/test/main.js +++ b/test/main.js @@ -696,6 +696,13 @@ describe('node-fetch', () => { }); }); + it('should handle response with no status text', () => { + const url = `${base}no-status-text`; + return fetch(url).then(res => { + expect(res.statusText).to.equal(''); + }); + }); + it('should handle no content response', () => { const url = `${base}no-content`; return fetch(url).then(res => { diff --git a/test/utils/server.js b/test/utils/server.js index 4d58ac4..310dce4 100644 --- a/test/utils/server.js +++ b/test/utils/server.js @@ -70,6 +70,10 @@ export default class TestServer { res.end('text'); } + if (p === '/no-status-text') { + res.writeHead(200, '', {}).end(); + } + if (p === '/options') { res.statusCode = 200; res.setHeader('Allow', 'GET, HEAD, OPTIONS');