mirror of
				https://gitea.publichub.eu/oscar.krause/fastapi-dls.git
				synced 2025-11-04 02:26:10 +00:00 
			
		
		
		
	typos
This commit is contained in:
		@@ -23,17 +23,17 @@ class PatchMalformedJsonMiddleware(BaseHTTPMiddleware):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        if self.enabled and content_type == 'application/json':
 | 
					        if self.enabled and content_type == 'application/json':
 | 
				
			||||||
            logger.debug(f'Using Request-Patch because "PatchMalformedJsonMiddleware" is enabled!')
 | 
					            logger.debug(f'Using Request-Patch because "PatchMalformedJsonMiddleware" is enabled!')
 | 
				
			||||||
 | 
					            body = body.decode()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            # try to fix json
 | 
					            # try to fix json
 | 
				
			||||||
            body = body.decode()
 | 
					 | 
				
			||||||
            try:
 | 
					            try:
 | 
				
			||||||
                j = json.loads(body)
 | 
					                j = json.loads(body)
 | 
				
			||||||
                self.fix_mac_address_list_length(j=j, size=1)
 | 
					                self.fix_mac_address_list_length(j=j, size=1)
 | 
				
			||||||
            except json.decoder.JSONDecodeError:
 | 
					            except json.decoder.JSONDecodeError:
 | 
				
			||||||
                logger.warning(f'Malformed json received! Try to fix it.')
 | 
					                logger.warning(f'Malformed json received! Try to fix it.')
 | 
				
			||||||
                s = PatchMalformedJsonMiddleware.fix_json(body)
 | 
					                body = PatchMalformedJsonMiddleware.fix_json(body)
 | 
				
			||||||
                logger.debug(f'Fixed JSON: "{s}"')
 | 
					                logger.debug(f'Fixed JSON: "{body}"')
 | 
				
			||||||
                j = json.loads(s)  # ensure json is now valid
 | 
					                j = json.loads(body)  # ensure json is now valid
 | 
				
			||||||
                j = self.fix_mac_address_list_length(j=j, size=1)
 | 
					                j = self.fix_mac_address_list_length(j=j, size=1)
 | 
				
			||||||
                # set new body
 | 
					                # set new body
 | 
				
			||||||
                request._body = json.dumps(j).encode('utf-8')
 | 
					                request._body = json.dumps(j).encode('utf-8')
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user