File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -223,13 +223,14 @@ async def get_camera(camera_id: int):
223223 @self .app .put ("/cameras/{camera_id}" )
224224 async def update_camera (camera_id : int , updated_fields : Request ):
225225 try :
226+ updated_fields = await updated_fields .json ()
227+
226228 if not isinstance (updated_fields , dict ):
227229 raise HTTPException (
228230 status_code = 400 ,
229231 detail = "Request body must be a JSON dict"
230232 )
231-
232- updated_fields = await updated_fields .json ()
233+
233234 camera = self .db_manager .update_camera (camera_id , updated_fields )
234235
235236 if camera is None :
@@ -251,13 +252,14 @@ async def update_camera(camera_id: int, updated_fields: Request):
251252 @self .app .put ("/zones/{zone_id}" )
252253 async def update_zone (zone_id : int , updated_fields : Request ):
253254 try :
255+ updated_fields = await updated_fields .json ()
256+
254257 if not isinstance (updated_fields , dict ):
255258 raise HTTPException (
256259 status_code = 400 ,
257260 detail = "Request body must be a JSON dict"
258261 )
259262
260- updated_fields = await updated_fields .json ()
261263 zone = self .db_manager .update_zone (zone_id , updated_fields )
262264
263265 if zone is None :
You can’t perform that action at this time.
0 commit comments