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

http/2 option toggle breaks request #1325

Closed
ghost opened this issue Jun 23, 2020 · 2 comments
Closed

http/2 option toggle breaks request #1325

ghost opened this issue Jun 23, 2020 · 2 comments

Comments

@ghost
Copy link

ghost commented Jun 23, 2020

Describe the bug

  • Node.js version: 12.13.1
  • OS & version: Windows 10

Actual behavior

Running a request to a URL with the http2 option set to true. Stop the program and run the same code, but with the option now set to false and the request no longer works.

RequestError: connect ECONNREFUSED
...

Expected behavior

Toggling http2 to false should make it fallback to http and not have any errors.
...

Code to reproduce

const got = require('got');
const url = `https://discord.com/`;

got(url, {
    resolveBodyOnly: false,
    retry: {
        limit: 0
    },
    http2: true
}).then((res) => {
    console.log(res);
}).catch((err) => {
    console.log(err);
});
...

Checklist

  • [ ✓ ] I have read the documentation.
  • [ ✓ ] I have tried my code with the latest version of Node.js and Got.
@Giotino
Copy link
Collaborator

Giotino commented Jun 23, 2020

Setting http2 explicitly to false or not setting it at all is the same.
I tried your example, I'm having no problem with http2: false, I think this might be a problem on your side.

I tried with Node.JS 12.13.1, 12.18.1 and 14.1.0.

@szmarczak
Copy link
Collaborator

I cannot reproduce on got@11.4.0.

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