I have a search box.
I search for:
<- blank spaces in my search box.
My form validation catches this.
The URL shows: ++++++++++++++++
If I search for: <script>alert(1);</script>
The URL shows: <script>alert%281%29%3B<%2Fscript>
The Question
Where in Django can I alter / change / modify the request that determines the request URL? I'm thinking middleware but I haven't found an example. Would I have to create an entirely new HttpRequest
from scratch?
Why do I want to?
I want to encode the URL differently. For example, strip all punctuation from the q=
value, replace whitespace, strip, replace single spaces with +
to have cleaner URLs.
Really looking for a clear example with CODE.