QUERY_STRING is assumed
See original GitHub issueAccording to https://github.com/jonashaag/bjoern/issues/118, QUERY_STRING cannot be assumed as part of the incoming environment.
Request.args and Request.json_args should assume QUERY_STRING="" when it is not present in the environment.
Example application:
from pycnic.core import WSGI, Handler
class Hello(Handler):
def get(self):
name = self.request.args.get("name", "Pycnic")
return {"msg": "Hello, %s!" % (name)}
class app(WSGI):
routes = [("/hello", Hello())]
if __name__ == "__main__":
import bjoern
bjoern.run(app, "127.0.0.1", 8000)
When run, requests to http://localhost:8000 err:
'QUERY_STRING'
Traceback (most recent call last):
File "/XXXX/lib/python3.8/site-packages/pycnic/core.py", line 237, in __iter__
resp = self.delegate()
File "/XXXX/lib/python3.8/site-packages/pycnic/core.py", line 310, in delegate
output = func(*args)
File "app.py", line 6, in get
name = self.request.args.get("name", "Pycnic")
File "/XXXX/lib/python3.8/site-packages/pycnic/core.py", line 81, in args
qs = self.environ["QUERY_STRING"]
KeyError: 'QUERY_STRING'
Issue Analytics
- State:
- Created a year ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Query string | Node.js v19.3.0 Documentation
The node:querystring module provides utilities for parsing and formatting URL ... characters within the query string will be assumed to use UTF-8 encoding....
Read more >Plus sign in query string - Stack Overflow
I placed a parameter value in the querystring with a plus(+) sign. But the plus sign disappear. How can I include the plus...
Read more >Query String in Node.js and its Methods - KnowledgeHut
This method of changing an object to query string is called serialized. The latest UTF-8 encoding format is assumed unless we specify a ......
Read more >How to get the query string values in JavaScript - Educative.io
A query string is used to assign a specific value to the parameter. For example: ... let's assume current URL is: https://example.com?name=Shubham&age=22
Read more >Getting Query String Parameters Safely and Concisely in C# ...
But that assumes our parameter will actually be a numeric string. And you should never make assumptions about what's in your query string....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@nullism - It appears as if
QUERY_STRINGis not assumed to be present according to the linked PEP. I encountered an unsetQUERY_STRINGwhen playing with bjoern; not sure if other servers act similarly.Uploaded as v0.1.9