title: FastAPI handling camelCase and PascalCase same time
body: <p>How can I handling PascalCase and camelCase requests bodies to snake_case same time in FastAPI app?
  I tried to use middleware and routerHandler to replace camelCase to PascalCase, but it works not so good.</p>
  <pre><code>class CustomRouteHandler(APIRoute):
  
      def get_route_handler(self) -&gt; Callable:
          original_route_handler = super().get_route_handler()
  
          async def custom_route_handler(request: Request) -&gt; Response:
              route_path = request.url.path
              body = await request.body()
              logger.info({&quot;path&quot;: request.url.path, &quot;request&quot;: request._body.decode(&quot;utf-8&quot;)})
              if body:
                  body = ujson.dumps(humps.pascalize(ujson.loads(body.decode(&quot;utf-8&quot;)))).encode(&quot;ascii&quot;)
              request._body = body
              try:
                  return await original_route_handler(request)
              except ValidationError as e:
                  logger.exception(e, exc_info=True)
                  return UJSONResponse(status_code=200, content={&quot;Success&quot;: False, &quot;Message&quot;: e})
              
          return custom_route_handler
  
  router = APIRouter(prefix=&quot;/payments&quot;, route_class=CustomRouteHandler)
  </code></pre>
  <p>When I logging this code, all fine. But it returns ValidationError:</p>
  <pre><code>request body: {&quot;test&quot;: 12345}
  logger after pascalize: {&quot;Test&quot;: 12345}
  ERROR: 1 validation error for Request\nbody -&gt; Test 
  none is not an allowed value (type=type_error.none.not_allowed)
  </code></pre>