Answer the question
In order to leave comments, you need to log in
Why is QUERY_STRING empty on POST request?
A GET request gives a normal QUERY_STRING, unlike a POST request.
Proper form
<form action="" method="post">
<div class="input-group"><input type="text" name="first_name" placeholder="Имя" required></div>
<div class="input-group"><input type="text" name="last_name" placeholder="Фамилия" required></
<div class="input-group">
<button class="button" type="submit" onclick="testPhone(this.value);">Отправить</button>
</div>
</form>
'REQUEST_METHOD': 'POST', 'PATH_INFO': '/comment/', 'HTTP_ORIGIN': 'localhost', 'SERVER_PROTOCOL': 'HTTP/1.1', 'QUERY_STRING': 'regid=asd',
Answer the question
In order to leave comments, you need to log in
QUERY_STRING is the query string (the one after the last slash). With a post request, the parameters are passed in the body of the request, while the query string is most often empty
I saw a lot of words, but there was no answer.
request_body_size = int(environ.get('CONTENT_LENGTH', 0))
if request_body_size:
request_body = dict(urlparse.parse_qs(urllib.unquote(environ['wsgi.input'].read(request_body_size)).decode('utf-8')))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question