chaijs / chai-http

HTTP Response assertions for the Chai Assertion Library.
http://chaijs.com/plugins/chai-http
632 stars 112 forks source link

Property 'request' does not exist on type 'Response'.ts (2339) #294

Closed mandarons closed 10 months ago

mandarons commented 3 years ago

Versions:

chai: 4.3.4 chai-http: 4.3.0

Step to reproduce:

it('/favicon.ico should redirect to /', async () => {
        const response = await chai.request(service)
            .get('/favicon.ico');
        response.redirects[0].should.be.equal(response.request.url);
    });

Note: @types/chai-http is NOT installed.

austince commented 3 years ago

Would this be solved by https://github.com/chaijs/chai-http/pull/293 ?

mandarons commented 3 years ago

@austince it didn't. I made the one line change of -

 type Request = request.SuperAgentRequest;

in node-modules/chai-http/types/index.d.ts. It didn't fix the problem.

austince commented 3 years ago

I would think this is an issue with the superagent types then, if this is indeed a valid property.