We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Is adding support for x-www-form-urlencoded something that would be accepted/supported?
The text was updated successfully, but these errors were encountered:
hi @aragilar ,
Yes, I think supporting that would make sense.
Just to be precise, do you mean sending a POST/PUT/etc request to the server with the body like this?
requests.post(httpserver.url_for("/foo"), data={"foo": "bar"})
And then, pytest-httpserver would have something like this:
httpserver.expect_request("/foo", data_form=MultiDict({"foo": "bar"})).respond_with_handler(handler)
(see data_form field).
data_form
On the other hand, do you know that you can specify your own handler?
from pytest_httpserver import HTTPServer import requests from werkzeug import Request, Response from werkzeug.datastructures import MultiDict def test_www_form_urlencoded(httpserver: HTTPServer): def handler(request: Request) -> Response: if request.form == MultiDict({"foo": "bar"}): return Response("OK") else: return Response(status=500) httpserver.expect_request("/foo").respond_with_handler(handler) assert requests.post(httpserver.url_for("/foo"), data={"foo": "bar"}).text == "OK"
Sorry, something went wrong.
No branches or pull requests
Is adding support for x-www-form-urlencoded something that would be accepted/supported?
The text was updated successfully, but these errors were encountered: