-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes method post #9
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please fix those things and rebase on master after #8 is merged?
uwsgi_tools/curl.py
Outdated
if body is None: | ||
body = ''.encode('utf-8') | ||
else: | ||
body = body.encode('utf-8') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make it in one line
body = (body or '').encode('utf-8')
uwsgi_tools/curl.py
Outdated
for header in headers or (): | ||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.