-
I have a small application using falcon-api, URI-s can have special characters like:
When I send above URI, it's percent-encoded to:
I use gunicorn, gunicorn pass this to falcon as:
After it's encoded+decoded in request.py here (I guess):
The result is:
Instead of the original:
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 13 replies
-
Hi @vpas88! |
Beta Was this translation helpful? Give feedback.
-
I've used the following import falcon
class Inspector:
def on_get(self, req, resp, param):
resp.media = {
'headers': req.headers,
'method': req.method,
'param': param,
'uri': req.uri,
}
app = falcon.App()
app.add_route('/{param}', Inspector()) Packages used (on CPython 3.10):
Sending a request similar to yours:
Could it be that you had a very old version of Gunicorn, Falcon, or just your HTTP client encodes or decodes not in a way you would expect it? Which client or browser are you using? |
Beta Was this translation helpful? Give feedback.
-
I have executed the following with your code (i used curl) and I see the same problem:
As you can see I have the same versions like you. |
Beta Was this translation helpful? Give feedback.
OK, finally I have manage to solve the problem. I'm putting the solution here for future reference; when using NGINX and URI is parsed in location proxy_pass will get the decoded value.
My solution was that:
This way the original percentage-encoded format is passed towards gunicorn/falcon and they will parse it properly.