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

status code 406 returns by an URL where it's possible to download with wget and curl #2490

Closed
Skywalker13 opened this issue Dec 20, 2016 · 2 comments
Labels

Comments

@Skywalker13
Copy link

Skywalker13 commented Dec 20, 2016

With request, the result is an empty file and the 406 status code printed in the console.

'use strict';

const fs      = require ('fs');
const request = require ('request');
require ('request-debug') (request);

request
  .get ('https://alioth.debian.org/frs/download.php/file/3979/chrpath-0.16.tar.gz')
  .on ('response', function (res) {
    console.log (res.statusCode);
  })
  .pipe (fs.createWriteStream ('chrpath-0.16.tar.gz'));

output

{ request: 
   { debugId: 1,
     uri: 'https://alioth.debian.org/frs/download.php/file/3979/chrpath-0.16.tar.gz',
     method: 'GET',
     headers: { host: 'alioth.debian.org' } } }
{ response: 
   { debugId: 1,
     headers: 
      { date: 'Tue, 20 Dec 2016 17:57:59 GMT',
        server: 'Apache/2.2.22 (Debian)',
        'x-powered-by': 'PHP/5.4.45-0+deb7u6',
        'x-robots-tag': 'noindex, nofollow',
        vary: 'Accept-Encoding',
        'content-length': '0',
        connection: 'close',
        'content-type': 'text/html; charset=UTF-8' },
     statusCode: 406 } }
406
@Skywalker13
Copy link
Author

Ok, it's fixed with this change:

request
  .get ({
    url: 'https://alioth.debian.org/frs/download.php/file/3979/chrpath-0.16.tar.gz',
    headers: {
      Accept: '*/*'
    }
  })

Not sure if it's an issue or not..

@stale
Copy link

stale bot commented Nov 23, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 23, 2018
@stale stale bot closed this as completed Dec 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant