Remove unnecessary '?' from req.path on POST #1943

Merged
merged 1 commit into from Jan 31, 2014

Projects

None yet

3 participants

@kdmukai

The if/else logic in add_auth on line 491 only handles if qs and POST.

But if you're POSTing with no query string, execution falls into the else condition on line 497 and an unnecessary '?' is added with a blank query string.

My elastictranscoder.create_job calls were failing due to the unnecessary '?' in the path. It would return:

JSONResponseError: 403 Forbidden
{u'message': u"When Content-Type:application/x-www-form-urlencoded, URL cannot include query-string parameters (after '?'): '/2012-09-25/jobs?'"}

I'm not sure why, but the bug only happens when running on Google App Engine. My local dev_appserver was able to make the create_job request just fine.

@kdmukai kdmukai Remove unnecessary '?' from req.path on POST
The if/else logic in add_auth on line 491 only handles if qs and POST.

But if you're POSTing with no query string, execution falls into the else condition on line 497 and an unnecessary '?' is added with a blank query string.

My elastictranscoder.create_job calls were failing due to the unnecessary '?' in the path. It would return:

JSONResponseError: 403 Forbidden
{u'message': u"When Content-Type:application/x-www-form-urlencoded, URL cannot include query-string parameters (after '?'): '/2012-09-25/jobs?'"}

I'm not sure why, but the bug only happens when running on Google App Engine. My local dev_appserver was able to make the create_job request just fine.
b7a8b19
@danielgtaylor
the boto project member

Thanks for the fix. Can you please add a unit test to make sure this bug doesn't get reintroduced in the future? There are some examples in https://github.com/boto/boto/blob/develop/tests/unit/auth/test_query.py#L68

@pasc pasc added a commit to pasc/boto that referenced this pull request Jan 28, 2014
@pasc pasc Added unit test for #1943 f5988dd
@toastdriven toastdriven merged commit b7a8b19 into boto:develop Jan 31, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment