Fixes method post#9
Conversation
| if body is None: | ||
| body = ''.encode('utf-8') | ||
| else: | ||
| body = body.encode('utf-8') |
There was a problem hiding this comment.
Let's make it in one line
body = (body or '').encode('utf-8')| key, _, value = header.partition(':') | ||
| var['HTTP_' + key.strip().upper()] = value.strip() | ||
| var['HTTP_' + key.strip().upper().replace('-', '_')] = value.strip() | ||
| if 'HTTP_CONTENT-TYPE' in var.keys(): |
There was a problem hiding this comment.
It's probably a typo there and I wonder do we even need HTTP_CONTENT_TYPE there at all?
There was a problem hiding this comment.
This is indeed a typo and should be HTTP_CONTENT_TYPE.
However, we do still need it. In much the same way we're special casing SERVER_NAME and SERVER_PORT we also need to extract the well used uWSGI param CONTENT_TYPE from the header HTTP_CONTENT_TYPE.
cc4015f to
1e5d194
Compare
1e5d194 to
eab6acd
Compare
|
So now when #8 is merged, could you please rebase on master? |
eab6acd to
4ef593a
Compare
|
Rebased and ready for review. |
4ef593a to
f5faed6
Compare
|
Hey @andreif 👋 . Is there anything I left I need to do to get this PR merged? |
|
@tomdottom Hey! Thanks a lot for all the commits! I just need to find few calm minutes to go through them 😄 |
Adds CONTENT_LENGTH & CONTENT_TYPE so that post requests work correctly
Many frameworks/applications will rely on CONTENT_LENGTH to determine the length of the body appended to the end of uwsgi_packet_header + uwsgi_vars.