Test empty status text (#1069)
This commit is contained in:
parent
8eeeec18c1
commit
f2ff9ecd04
|
@ -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 => {
|
||||
|
|
|
@ -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');
|
||||
|
|
Loading…
Reference in New Issue