prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Custom media handlers: Unexpected issue when providing custom json handler
  This is in falcon-2.0
  
  Look at the documentation [here][1] for using rapidjson for encoding/decoding json. By providing:
  
  `extra_handlers={'application/json': json_handler}` we are still left with the default handler for content-type `application-json; charset=UTF-8`. This results in an unexpected behaviour when some client library (e.g. Retrofit for Android) includes the charset in the header. 
  
  While the documentation should be updated, the expected behaviour is that if the handler for `application/json` is updated - it should also update the handler for variant with charset (or at least throw a warning) otherwise there is a possibility of hidden bugs. 
  
  [1]: https://falcon.readthedocs.io/en/stable/api/media.html
  
  </issue>
  <code>
  [start of falcon/media/handlers.py]
  1 from collections import UserDict
  2 
  3 from falcon import errors
  4 from falcon.constants import MEDIA_MULTIPART, MEDIA_URLENCODED
  5 from falcon.media.json import JSONHandler
  6 from falcon.media.multipart import MultipartFormHandler, MultipartParseOptions
  7 from falcon.media.urlencoded import URLEncodedFormHandler
  8 from falcon.vendor import mimeparse
  9 
  10 
  11 class Handlers(UserDict):
  12     """A :class:`dict`-like object that manages Internet media type handlers."""
  13     def __init__(self, initial=None):
  14         handlers = initial or {
  15             'application/json': JSONHandler(),
  16             'application/json; charset=UTF-8': JSONHandler(),
  17             MEDIA_MULTIPART: MultipartFormHandler(),
  18             MEDIA_URLENCODED: URLEncodedFormHandler(),
  19         }
  20 
  21         # NOTE(jmvrbanac): Directly calling UserDict as it's not inheritable.
  22         # Also, this results in self.update(...) being called.
  23         UserDict.__init__(self, handlers)
  24 
  25     def _resolve_media_type(self, media_type, all_media_types):
  26         resolved = None
  27 
  28         try:
  29             # NOTE(jmvrbanac): Mimeparse will return an empty string if it can
  30             # parse the media type, but cannot find a suitable type.
  31             resolved = mimeparse.best_match(
  32                 all_media_types,
  33                 media_type
  34             )
  35         except ValueError:
  36             pass
  37 
  38         return resolved
  39 
  40     def find_by_media_type(self, media_type, default):
  41         # PERF(jmvrbanac): Check via a quick methods first for performance
  42         if media_type == '*/*' or not media_type:
  43             media_type = default
  44 
  45         try:
  46             return self.data[media_type]
  47         except KeyError:
  48             pass
  49 
  50         # PERF(jmvrbanac): Fallback to the slower method
  51         resolved = self._resolve_media_type(media_type, self.data.keys())
  52 
  53         if not resolved:
  54             raise errors.HTTPUnsupportedMediaType(
  55                 description='{0} is an unsupported media type.'.format(media_type)
  56             )
  57 
  58         return self.data[resolved]
  59 
  60 
  61 # NOTE(vytas): An ugly way to work around circular imports.
  62 MultipartParseOptions._DEFAULT_HANDLERS = Handlers({
  63     'application/json': JSONHandler(),
  64     'application/json; charset=UTF-8': JSONHandler(),
  65     MEDIA_URLENCODED: URLEncodedFormHandler(),
  66 })  # type: ignore
  67
  [end of falcon/media/handlers.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/falcon/media/handlers.py b/falcon/media/handlers.py
  --- a/falcon/media/handlers.py
  +++ b/falcon/media/handlers.py
  @@ -1,7 +1,7 @@
   from collections import UserDict
   
   from falcon import errors
  -from falcon.constants import MEDIA_MULTIPART, MEDIA_URLENCODED
  +from falcon.constants import MEDIA_JSON, MEDIA_MULTIPART, MEDIA_URLENCODED
   from falcon.media.json import JSONHandler
   from falcon.media.multipart import MultipartFormHandler, MultipartParseOptions
   from falcon.media.urlencoded import URLEncodedFormHandler
  @@ -12,8 +12,7 @@
       """A :class:`dict`-like object that manages Internet media type handlers."""
       def __init__(self, initial=None):
           handlers = initial or {
  -            'application/json': JSONHandler(),
  -            'application/json; charset=UTF-8': JSONHandler(),
  +            MEDIA_JSON: JSONHandler(),
               MEDIA_MULTIPART: MultipartFormHandler(),
               MEDIA_URLENCODED: URLEncodedFormHandler(),
           }
  @@ -60,7 +59,6 @@
   
   # NOTE(vytas): An ugly way to work around circular imports.
   MultipartParseOptions._DEFAULT_HANDLERS = Handlers({
  -    'application/json': JSONHandler(),
  -    'application/json; charset=UTF-8': JSONHandler(),
  +    MEDIA_JSON: JSONHandler(),
       MEDIA_URLENCODED: URLEncodedFormHandler(),
   })  # type: ignore
  
verification_info: {"golden_diff": "diff --git a/falcon/media/handlers.py b/falcon/media/handlers.py\n--- a/falcon/media/handlers.py\n+++ b/falcon/media/handlers.py\n@@ -1,7 +1,7 @@\n from collections import UserDict\n \n from falcon import errors\n-from falcon.constants import MEDIA_MULTIPART, MEDIA_URLENCODED\n+from falcon.constants import MEDIA_JSON, MEDIA_MULTIPART, MEDIA_URLENCODED\n from falcon.media.json import JSONHandler\n from falcon.media.multipart import MultipartFormHandler, MultipartParseOptions\n from falcon.media.urlencoded import URLEncodedFormHandler\n@@ -12,8 +12,7 @@\n     \"\"\"A :class:`dict`-like object that manages Internet media type handlers.\"\"\"\n     def __init__(self, initial=None):\n         handlers = initial or {\n-            'application/json': JSONHandler(),\n-            'application/json; charset=UTF-8': JSONHandler(),\n+            MEDIA_JSON: JSONHandler(),\n             MEDIA_MULTIPART: MultipartFormHandler(),\n             MEDIA_URLENCODED: URLEncodedFormHandler(),\n         }\n@@ -60,7 +59,6 @@\n \n # NOTE(vytas): An ugly way to work around circular imports.\n MultipartParseOptions._DEFAULT_HANDLERS = Handlers({\n-    'application/json': JSONHandler(),\n-    'application/json; charset=UTF-8': JSONHandler(),\n+    MEDIA_JSON: JSONHandler(),\n     MEDIA_URLENCODED: URLEncodedFormHandler(),\n })  # type: ignore\n", "issue": "Custom media handlers: Unexpected issue when providing custom json handler\nThis is in falcon-2.0\r\n\r\nLook at the documentation [here][1] for using rapidjson for encoding/decoding json. By providing:\r\n\r\n`extra_handlers={'application/json': json_handler}` we are still left with the default handler for content-type `application-json; charset=UTF-8`. This results in an unexpected behaviour when some client library (e.g. Retrofit for Android) includes the charset in the header. \r\n\r\nWhile the documentation should be updated, the expected behaviour is that if the handler for `application/json` is updated - it should also update the handler for variant with charset (or at least throw a warning) otherwise there is a possibility of hidden bugs. \r\n\r\n[1]: https://falcon.readthedocs.io/en/stable/api/media.html\n", "before_files": [{"content": "from collections import UserDict\n\nfrom falcon import errors\nfrom falcon.constants import MEDIA_MULTIPART, MEDIA_URLENCODED\nfrom falcon.media.json import JSONHandler\nfrom falcon.media.multipart import MultipartFormHandler, MultipartParseOptions\nfrom falcon.media.urlencoded import URLEncodedFormHandler\nfrom falcon.vendor import mimeparse\n\n\nclass Handlers(UserDict):\n    \"\"\"A :class:`dict`-like object that manages Internet media type handlers.\"\"\"\n    def __init__(self, initial=None):\n        handlers = initial or {\n            'application/json': JSONHandler(),\n            'application/json; charset=UTF-8': JSONHandler(),\n            MEDIA_MULTIPART: MultipartFormHandler(),\n            MEDIA_URLENCODED: URLEncodedFormHandler(),\n        }\n\n        # NOTE(jmvrbanac): Directly calling UserDict as it's not inheritable.\n        # Also, this results in self.update(...) being called.\n        UserDict.__init__(self, handlers)\n\n    def _resolve_media_type(self, media_type, all_media_types):\n        resolved = None\n\n        try:\n            # NOTE(jmvrbanac): Mimeparse will return an empty string if it can\n            # parse the media type, but cannot find a suitable type.\n            resolved = mimeparse.best_match(\n                all_media_types,\n                media_type\n            )\n        except ValueError:\n            pass\n\n        return resolved\n\n    def find_by_media_type(self, media_type, default):\n        # PERF(jmvrbanac): Check via a quick methods first for performance\n        if media_type == '*/*' or not media_type:\n            media_type = default\n\n        try:\n            return self.data[media_type]\n        except KeyError:\n            pass\n\n        # PERF(jmvrbanac): Fallback to the slower method\n        resolved = self._resolve_media_type(media_type, self.data.keys())\n\n        if not resolved:\n            raise errors.HTTPUnsupportedMediaType(\n                description='{0} is an unsupported media type.'.format(media_type)\n            )\n\n        return self.data[resolved]\n\n\n# NOTE(vytas): An ugly way to work around circular imports.\nMultipartParseOptions._DEFAULT_HANDLERS = Handlers({\n    'application/json': JSONHandler(),\n    'application/json; charset=UTF-8': JSONHandler(),\n    MEDIA_URLENCODED: URLEncodedFormHandler(),\n})  # type: ignore\n", "path": "falcon/media/handlers.py"}]}