Pylons / Pylons/webtest

TestApp.get should pass REQUEST_URI

Open
#1 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
346
Forks
113
PR merge metrics
No merged PRs in 30d

Description

Anonymous:

A common workaround for unicode and slashes encoded in the URL
is to have the wsgi app server pass REQUEST_URI and then deal
with it in middleware. It would be nice to
be able to test said middleware.
For now, a workaround is to wrap TestApp.get and always specify
extra_environ={'REQUEST_URI':url}.

Ian Bicking:

This may be hard to implement correctly, as the request construction
deconstructs the URL, and that's happening in WebOb. I don't think
the change would be appropriate for WebOb itself. Also quite a lot
of WSGI servers at this point don't set REQUEST_URI, so always
having it on doesn't seem like a good idea (having it off is more
representative of lowest-common-denominator WSGI servers).
An option to turn it on seems okay though (something you can pass
in when instantiating TestApp).

URL: https://bitbucket.org/ianb/webtest/issue/8/testappget-should-pass-request_uri

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with TestApp.get and the TestApp instantiation options, then trace how request URLs are constructed before reaching WebOb. Define the option's expected behavior for REQUEST_URI and add tests showing it is opt-in, with completion requiring middleware to receive the supplied URL when enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.