Opened 15 years ago

Closed 14 years ago

#12522 closed Bug (duplicate)

Unable to get request.POST after request.get_raw_post_data

Reported by: Maxim Ivanov Owned by: nobody
Component: HTTP handling Version: 1.1
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

I need to get raw request body, the only solution I found is request.get_raw_post_data, but once I accessed it I am unable to use request.POST anymore. From my point of view access to request.POST should check if cached body data already exist and if yes try to use it instead of reading environwsgi.input

Attachments (2)

raw_post.diff (3.4 KB ) - added by Maxim Ivanov 15 years ago.
Fix patch + regression tests on WSGI handler
12522-tests.diff (2.9 KB ) - added by Ramiro Morales 14 years ago.
Tests converted to unit tests

Download all attachments as: .zip

Change History (11)

comment:1 by Maxim Ivanov, 15 years ago

Component: UncategorizedHTTP handling

by Maxim Ivanov, 15 years ago

Attachment: raw_post.diff added

Fix patch + regression tests on WSGI handler

comment:2 by Maxim Ivanov, 15 years ago

Has patch: set

Attaching patch which fixes problem for WSGI handler with regression tests provided. Patch for mod_python is there too. Basically it fixes access to request.POST and requst.raw_post_data in any order in case of multipart POST content type.

I am not familiar with mod_python and don't know what is 'req' argument passed by handler, thats why there are no regression tests for mod_python handler.

comment:3 by Russell Keith-Magee, 15 years ago

Triage Stage: UnreviewedAccepted

comment:4 by Karen Tracey, 14 years ago

#14024 reported this again and proposed a different approach to fix.

comment:5 by Piotr Czachur, 14 years ago

This issue is related: #14035 (Cannot access POST after request.encoding was set to a custom value)

comment:6 by Piotr Czachur, 14 years ago

Another related issue: #14753 (Accessing (Get)HttpRequest.raw_post_data in view results in exception during testing)

by Ramiro Morales, 14 years ago

Attachment: 12522-tests.diff added

Tests converted to unit tests

comment:7 by Ramiro Morales, 14 years ago

Patch needs improvement: set

The patch doesn't apply anymore because a) Since then there has been a code shuffle for the HTTPRequest streaming feature and b) Most of our tests were converted to unit tests.

I've attached redbaron's tests updated to apply to trunk as of now. They add two failing cases.

comment:8 by Matt McClanahan, 14 years ago

Severity: Normal
Type: Bug

comment:9 by vkryachko, 14 years ago

Resolution: duplicate
Status: newclosed

This is a duplicate of #15679

Note: See TracTickets for help on using tickets.
Back to Top