Coder Social home page Coder Social logo

Comments (2)

johnsmith0209 avatar johnsmith0209 commented on May 22, 2024

Same here, but get error messages

[email protected]
[email protected]

const agent = new http2Wrapper.proxies.HttpOverHttp2({
    proxyOptions: {
        url: `http://127.0.0.1:10809`,
        rejectUnauthorized: false,
    }
});
const options = {
    url: 'https://httpbin.org/ip',
    http2: true,
    agent: {
        http2: agent,
    }
};
const result = await got(options).json();

The error message is:

RequestError: The "options.agent" property must be one of type http2wrapper.Agent-like Object, undefined or false. Received object

This indicates that the return value of http2Wrapper.proxies.HttpOverHttp2 is not http2wrapper.Agent like.
But the original post of http2-wrapper agent is confusing, and there is not an argument can pass in something like 'url', for the end-point of the proxy server.

from got.

johnsmith0209 avatar johnsmith0209 commented on May 22, 2024

So, I used the wrong proxy class.

The followed worked for me:

const agent = new http2Wrapper.proxies.Http2OverHttp({
    proxyOptions: {
        url: `http://127.0.0.1:10809`,
        rejectUnauthorized: false,
    }
});
const options = {
    url: 'https://httpbin.org/ip',
    http2: true,
    agent: {
        http2: agent,
    }
};
const result = await got(options).json();

@wildwind3325

from got.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.