BedrockStreaming/superagent-mock

Cannot read properties of undefined (reading 'prototype')

Closed this issue ยท 5 comments

Hey thanks for this package! I have the following issue: when it's used with https://www.npmjs.com/package/supertest
the following line breaks
https://github.com/BedrockStreaming/superagent-mock/blob/v5.0.0/src/superagent-mock.js#L15

because the agent object exposed by supertest doesn't have a Request property, I'm assuming that's the issue
https://github.com/ladjs/supertest/blob/v6.3.3/lib/agent.js#L51

I know that it sounds like a supertest issue but was wondering if you'd be interested to update you plugin as well ?

for now I added it manually to the agent instance exposed by supertest:
agent.Request = { prototype: { end: function () {} } };

Hi @ihorbond, thanks for your interest for this package ๐Ÿ™‚
Fell free to make a PR to fix this issue with supertest ๐Ÿ˜‰

@fdubost please take a look #118

@fdubost could you please merge the PR?

@ihorbond it's done, sorry for the delay ๐Ÿ˜