Skip to content

Fixes method post#9

Open
tomdottom wants to merge 1 commit into
andreif:masterfrom
tomdottom:fixes-method-post
Open

Fixes method post#9
tomdottom wants to merge 1 commit into
andreif:masterfrom
tomdottom:fixes-method-post

Conversation

@tomdottom

Copy link
Copy Markdown
Contributor

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.

@andreif andreif left a comment

Copy link
Copy Markdown
Owner

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?

Comment thread uwsgi_tools/curl.py Outdated
if body is None:
body = ''.encode('utf-8')
else:
body = body.encode('utf-8')

Copy link
Copy Markdown
Owner

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')

Comment thread uwsgi_tools/curl.py Outdated
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():

Copy link
Copy Markdown
Owner

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?

Copy link
Copy Markdown
Contributor Author

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.

@tomdottom tomdottom force-pushed the fixes-method-post branch 4 times, most recently from cc4015f to 1e5d194 Compare May 25, 2018 13:29
@tomdottom

tomdottom commented May 25, 2018

Copy link
Copy Markdown
Contributor Author

I should also point out that this work is base on top of #8.
If you're happy with this PR you can merge it and simply close #8.

@coveralls

coveralls commented May 25, 2018

Copy link
Copy Markdown

Coverage Status

Coverage remained the same at ?% when pulling f5faed6 on tomdottom:fixes-method-post into a86fea9 on andreif:master.

@andreif

andreif commented May 30, 2018

Copy link
Copy Markdown
Owner

So now when #8 is merged, could you please rebase on master?

@tomdottom tomdottom force-pushed the fixes-method-post branch from eab6acd to 4ef593a Compare May 30, 2018 12:48
@tomdottom

Copy link
Copy Markdown
Contributor Author

Rebased and ready for review.

@tomdottom tomdottom force-pushed the fixes-method-post branch from 4ef593a to f5faed6 Compare May 30, 2018 12:57
@tomdottom

Copy link
Copy Markdown
Contributor Author

Hey @andreif 👋 . Is there anything I left I need to do to get this PR merged?

@andreif

andreif commented Jun 7, 2018

Copy link
Copy Markdown
Owner

@tomdottom Hey! Thanks a lot for all the commits! I just need to find few calm minutes to go through them 😄

@andreif andreif self-requested a review June 7, 2018 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants