Skip to content

Commit f2ff9ec

Browse files
authored
Test empty status text (node-fetch#1069)
1 parent 8eeeec1 commit f2ff9ec

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

test/main.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,13 @@ describe('node-fetch', () => {
696696
});
697697
});
698698

699+
it('should handle response with no status text', () => {
700+
const url = `${base}no-status-text`;
701+
return fetch(url).then(res => {
702+
expect(res.statusText).to.equal('');
703+
});
704+
});
705+
699706
it('should handle no content response', () => {
700707
const url = `${base}no-content`;
701708
return fetch(url).then(res => {

test/utils/server.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ export default class TestServer {
7070
res.end('text');
7171
}
7272

73+
if (p === '/no-status-text') {
74+
res.writeHead(200, '', {}).end();
75+
}
76+
7377
if (p === '/options') {
7478
res.statusCode = 200;
7579
res.setHeader('Allow', 'GET, HEAD, OPTIONS');

0 commit comments

Comments
 (0)