forwardemail / forwardemail/superagent

DELETE request fails in node, but works in browser

Open
#799 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
16.6k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

As the title suggests, I have a request which works in browser, but fails in node with the following cryptic error:

```
events.js:141
throw er; // Unhandled 'error' event
^

Error: unexpected end of file
at Zlib._handle.onerror (zlib.js:363:17)
```

I did `console.log(request)` in node to debug, the following is the output. I omitted `socket` and `connection` properties in `req` for brevity.

``` js
Request {
domain: null,
_events: { end: [Function: bound ] },
_eventsCount: 1,
_maxListeners: undefined,
_agent: false,
_formData: null,
method: 'DELETE',
url: 'http://localhost:3000/~stars',
header: {},
writable: true,
_redirects: 0,
_maxRedirects: 5,
cookies: '',
qs: { starGroupId: 'eq.1', starrerId: 'eq.5' },
qsRaw: [],
_redirectList: [],
req:
ClientRequest {
domain: null,
_events: { drain: [Function], error: [Function] },
_eventsCount: 2,
_maxListeners: undefined,
output: [],
outputEncodings: [],
outputCallbacks: [],
outputSize: 0,
writable: true,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedHeader: {},
_contentLength: null,
_hasBody: true,
finished: false,
_headerSent: false,
_header: null,
_headers:
{ host: 'localhost:3000',
'accept-encoding': 'gzip, deflate',
'user-agent': 'node-superagent/1.4.0',
accept: 'application/json',
authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlIjoicGVyc29uIiwiYWdlbnRfaWQiOjUsImlhdCI6MTQ0ODkyMzYzMSwiZXhwIjoxNDQ4OTI0ODMxfQ.gEYceI0VwgDucp7r8o5zQbKr7eT2T_s9p45JWChbZbc' },
_headerNames:
{ host: 'Host',
'accept-encoding': 'Accept-Encoding',
'user-agent': 'User-Agent',
accept: 'Accept',
authorization: 'Authorization' },
method: 'DELETE',
path: '/~stars' },
protocol: 'http:',
host: 'localhost:3000' }
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.