jazzband / django-silk

Silky smooth profiling for Django
MIT License
4.32k stars 332 forks source link

Add support for multipart/form-data requests*** #704

Open ziyacivan opened 5 months ago

ziyacivan commented 5 months ago

Title: Add Support for Multipart/Form-Data Requests Description: I've encountered an issue when Silk attempts to handle multipart/form-data requests, specifically when trying to access request.body directly. This operation triggers a RawPostDataException because Django consumes the stream upon parsing the multipart data, making it inaccessible afterwards.

To address this, I've implemented a check for multipart/form-data content type within the request handling logic. When such a content type is detected, the code now properly handles form data and file information using request.POST and request.FILES, avoiding direct access to request.body. This allows Silk to gracefully handle and log multipart requests without raising exceptions.

codecov[bot] commented 5 months ago

Codecov Report

Attention: Patch coverage is 80.00000% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 86.56%. Comparing base (5577dd3) to head (212b987). Report is 2 commits behind head on master.

Files Patch % Lines
silk/model_factory.py 80.00% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #704 +/- ## ========================================== - Coverage 86.76% 86.56% -0.20% ========================================== Files 52 52 Lines 2115 2121 +6 ========================================== + Hits 1835 1836 +1 - Misses 280 285 +5 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

50-Course commented 3 months ago

Just found out six different test are failing, I do have to fix them by tomorrow. By the way, you are welcome to update the test cases if you want to.