Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DELETE request fails in node, but works in browser #799

Open
calebmer opened this issue Nov 30, 2015 · 6 comments
Open

DELETE request fails in node, but works in browser #799

calebmer opened this issue Nov 30, 2015 · 6 comments

Comments

@calebmer
Copy link

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.

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' }
@kornelski
Copy link
Contributor

Did you try v1.5.0?

@calebmer
Copy link
Author

1.5.0 hasn't been published to npm so no.

@calebmer
Copy link
Author

calebmer commented Dec 7, 2015

Any updates on this? Do you recommend I specify this repository for the 1.5.x version?

@kornelski
Copy link
Contributor

Please try 1.5.0 or master to see if the problem has been fixed already.

@calebmer
Copy link
Author

Sorry for taking so long, but I can confirm it fails in 1.5.0 and the master branch.

@calebmer
Copy link
Author

It seems like the request is being made successfully, but the response is failing to decompress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants