File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99
1010try :
1111 from django .http .request import RawPostDataException
12+
13+ _RAW_DATA_EXCEPTIONS = (RawPostDataException , ValueError )
1214except ImportError :
1315 RawPostDataException = None
16+ _RAW_DATA_EXCEPTIONS = (ValueError ,)
1417
1518from typing import TYPE_CHECKING
1619
@@ -110,7 +113,7 @@ def extract_into_event(self, event: "Event") -> None:
110113 raw_data = None
111114 try :
112115 raw_data = self .raw_data ()
113- except ( RawPostDataException , ValueError ) :
116+ except _RAW_DATA_EXCEPTIONS :
114117 # If DjangoRestFramework is used it already read the body for us
115118 # so reading it here will fail. We can ignore this.
116119 pass
@@ -175,7 +178,7 @@ def json(self) -> "Optional[Any]":
175178
176179 try :
177180 raw_data = self .raw_data ()
178- except ( RawPostDataException , ValueError ) :
181+ except _RAW_DATA_EXCEPTIONS :
179182 # The body might have already been read, in which case this will
180183 # fail
181184 raw_data = None
You can’t perform that action at this time.
0 commit comments