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

A PreparedRequest object is being passed to my callback instead of a Request object #205

Open
joaompfe opened this issue Apr 28, 2022 · 2 comments

Comments

@joaompfe
Copy link

Documentation says that request is of type Request but my callback function is receiving a PreparedRequest object instead.

My spec:
python = "^3.10"
requests = "^2.27.1"
pytest = "^7.1.1"
requests-mock = "^1.9.3"

@StefanBrand
Copy link

StefanBrand commented May 10, 2022

This leads to errors such as: AttributeError: 'PreparedRequest' object has no attribute 'params' as one would expect from the requests docs.

@jamielennox
Copy link
Owner

Hmm, i think this is a documentation issue. The way requests-mock works is via the Adapter.send method of requests and at which point the prepared bit has already been done.

In this case though actually the object is a _RequestObjectProxy which has a few helper methods, so i'll look at fixing the doc but if there's something you need like params we can probably make it work.

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

3 participants