We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Rename Request.body to Request.stream
Mirros Response. And it really is a stream.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `falcon/request.py`
Content:
```
1 """Defines the Request class.
2 
3 Copyright 2013 by Rackspace Hosting, Inc.
4 
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8 
9    http://www.apache.org/licenses/LICENSE-2.0
10 
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16 
17 """
18 
19 from datetime import datetime
20 
21 import six
22 
23 from falcon.request_helpers import *
24 from falcon.exceptions import *
25 
26 DEFAULT_ERROR_LOG_FORMAT = ('{0:%Y-%m-%d %H:%M:%S} [FALCON] [ERROR]'
27                             ' {1} {2}?{3} => {4}\n')
28 
29 
30 class Request(object):
31     """Represents a client's HTTP request"""
32 
33     __slots__ = (
34         'app',
35         'body',
36         '_headers',
37         'method',
38         '_params',
39         'path',
40         'protocol',
41         'query_string',
42         '_wsgierrors'
43     )
44 
45     def __init__(self, env):
46         """Initialize attributes based on a WSGI environment dict
47 
48         Note: Request is not meant to be instantiated directory by responders.
49 
50         Args:
51             env: A WSGI environment dict passed in from the server. See also
52                 the PEP-333 spec.
53 
54         """
55 
56         self._wsgierrors = env['wsgi.errors']
57         self.body = env['wsgi.input']
58 
59         self.protocol = env['wsgi.url_scheme']
60         self.app = env['SCRIPT_NAME']
61         self.method = env['REQUEST_METHOD']
62         self.path = env['PATH_INFO'] or '/'
63         self.query_string = query_string = env['QUERY_STRING']
64 
65         self._params = parse_query_string(query_string)
66         self._headers = parse_headers(env)
67 
68     def log_error(self, message):
69         """Log an error to wsgi.error
70 
71         Prepends timestamp and request info to message, and writes the
72         result out to the WSGI server's error stream (wsgi.error).
73 
74         Args:
75             message: A string describing the problem. If a byte-string and
76                 running under Python 2, the string is assumed to be encoded
77                 as UTF-8.
78 
79         """
80         if not six.PY3 and isinstance(message, unicode):
81             message = message.encode('utf-8')
82 
83         log_line = (
84             DEFAULT_ERROR_LOG_FORMAT.
85             format(datetime.now(), self.method, self.path,
86                    self.query_string, message)
87         )
88 
89         self._wsgierrors.write(log_line)
90 
91     def client_accepts_json(self):
92         """Return True if the Accept header indicates JSON support"""
93 
94         accept = self.get_header('Accept')
95         if accept is not None:
96             return ('application/json' in accept) or ('*/*' in accept)
97 
98         return False
99 
100     def get_header(self, name, default=None, required=False):
101         """Return a header value as a string
102 
103         Args:
104             name: Header name, case-insensitive (e.g., 'Content-Type')
105             default: Value to return in case the header is not
106               found (default None)
107             required: Set to True to raise HttpBadRequest instead
108               of returning gracefully when the header is not found
109               (default False)
110 
111         """
112 
113         # Use try..except to optimize for the header existing in most cases
114         try:
115             # Don't take the time to cache beforehand, using HTTP naming.
116             # This will be faster, assuming that most headers are looked
117             # up only once, and not all headers will be requested.
118             return self._headers[name.upper().replace('-', '_')]
119         except KeyError:
120             if not required:
121                 return default
122 
123             raise HTTPBadRequest('Missing header',
124                                  'The "' + name + '" header is required.')
125 
126     def get_param(self, name, default=None, required=False):
127         """Return the value of a query string parameter as a string
128 
129         Args:
130             name: Parameter name, case-sensitive (e.g., 'sort')
131             default: Value to return in case the parameter is not found in the
132                 query string (default None)
133             required: Set to True to raise HTTPBadRequest instead of returning
134                 gracefully when the parameter is not found (default False)
135 
136         Returns:
137             The value of the param as a byte string, or the default value if
138             param is not found and is not required.
139 
140         Raises
141             HTTPBadRequest: The param was not found in the request, but was
142                 required.
143 
144         """
145 
146         # PERF: Use if..in since it is a good all-around performer; we don't
147         #       know how likely params are to be specified by clients.
148         if name in self._params:
149             return self._params[name]
150 
151         if not required:
152             return default
153 
154         raise HTTPBadRequest('Missing query parameter',
155                              'The "' + name + '" query parameter is required.')
156 
157     def get_param_as_int(self, name, default=None, required=False):
158         """Return the value of a query string parameter as an int
159 
160         Args:
161             name: Parameter name, case-sensitive (e.g., 'limit')
162             default: Value to return in case the parameter is not found in the
163                 query string, or it is not an integer (default None)
164             required: Set to True to raise HTTPBadRequest instead of returning
165                 gracefully when the parameter is not found or is not an
166                 integer (default False)
167 
168         Returns:
169             The value of the param if it is found and can be converted to an
170             integer. Otherwise, returns the default value unless required is
171             True.
172 
173         Raises
174             HTTPBadRequest: The param was not found in the request, but was
175                 required.
176 
177         """
178 
179         # PERF: Use if..in since it is a good all-around performer; we don't
180         #       know how likely params are to be specified by clients.
181         if name in self._params:
182             val = self._params[name]
183             try:
184                 return int(val)
185             except ValueError:
186                 pass
187 
188         if not required:
189             return default
190 
191         raise HTTPBadRequest('Missing query parameter',
192                              'The "' + name + '" query parameter is required.')
193
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/falcon/request.py b/falcon/request.py
--- a/falcon/request.py
+++ b/falcon/request.py
@@ -32,13 +32,13 @@
 
     __slots__ = (
         'app',
-        'body',
         '_headers',
         'method',
         '_params',
         'path',
         'protocol',
         'query_string',
+        'stream',
         '_wsgierrors'
     )
 
@@ -54,7 +54,7 @@
         """
 
         self._wsgierrors = env['wsgi.errors']
-        self.body = env['wsgi.input']
+        self.stream = env['wsgi.input']
 
         self.protocol = env['wsgi.url_scheme']
         self.app = env['SCRIPT_NAME']

{"golden_diff": "diff --git a/falcon/request.py b/falcon/request.py\n--- a/falcon/request.py\n+++ b/falcon/request.py\n@@ -32,13 +32,13 @@\n \n     __slots__ = (\n         'app',\n-        'body',\n         '_headers',\n         'method',\n         '_params',\n         'path',\n         'protocol',\n         'query_string',\n+        'stream',\n         '_wsgierrors'\n     )\n \n@@ -54,7 +54,7 @@\n         \"\"\"\n \n         self._wsgierrors = env['wsgi.errors']\n-        self.body = env['wsgi.input']\n+        self.stream = env['wsgi.input']\n \n         self.protocol = env['wsgi.url_scheme']\n         self.app = env['SCRIPT_NAME']\n", "issue": "Rename Request.body to Request.stream\nMirros Response. And it really is a stream.\n\n", "before_files": [{"content": "\"\"\"Defines the Request class.\n\nCopyright 2013 by Rackspace Hosting, Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\n\"\"\"\n\nfrom datetime import datetime\n\nimport six\n\nfrom falcon.request_helpers import *\nfrom falcon.exceptions import *\n\nDEFAULT_ERROR_LOG_FORMAT = ('{0:%Y-%m-%d %H:%M:%S} [FALCON] [ERROR]'\n                            ' {1} {2}?{3} => {4}\\n')\n\n\nclass Request(object):\n    \"\"\"Represents a client's HTTP request\"\"\"\n\n    __slots__ = (\n        'app',\n        'body',\n        '_headers',\n        'method',\n        '_params',\n        'path',\n        'protocol',\n        'query_string',\n        '_wsgierrors'\n    )\n\n    def __init__(self, env):\n        \"\"\"Initialize attributes based on a WSGI environment dict\n\n        Note: Request is not meant to be instantiated directory by responders.\n\n        Args:\n            env: A WSGI environment dict passed in from the server. See also\n                the PEP-333 spec.\n\n        \"\"\"\n\n        self._wsgierrors = env['wsgi.errors']\n        self.body = env['wsgi.input']\n\n        self.protocol = env['wsgi.url_scheme']\n        self.app = env['SCRIPT_NAME']\n        self.method = env['REQUEST_METHOD']\n        self.path = env['PATH_INFO'] or '/'\n        self.query_string = query_string = env['QUERY_STRING']\n\n        self._params = parse_query_string(query_string)\n        self._headers = parse_headers(env)\n\n    def log_error(self, message):\n        \"\"\"Log an error to wsgi.error\n\n        Prepends timestamp and request info to message, and writes the\n        result out to the WSGI server's error stream (wsgi.error).\n\n        Args:\n            message: A string describing the problem. If a byte-string and\n                running under Python 2, the string is assumed to be encoded\n                as UTF-8.\n\n        \"\"\"\n        if not six.PY3 and isinstance(message, unicode):\n            message = message.encode('utf-8')\n\n        log_line = (\n            DEFAULT_ERROR_LOG_FORMAT.\n            format(datetime.now(), self.method, self.path,\n                   self.query_string, message)\n        )\n\n        self._wsgierrors.write(log_line)\n\n    def client_accepts_json(self):\n        \"\"\"Return True if the Accept header indicates JSON support\"\"\"\n\n        accept = self.get_header('Accept')\n        if accept is not None:\n            return ('application/json' in accept) or ('*/*' in accept)\n\n        return False\n\n    def get_header(self, name, default=None, required=False):\n        \"\"\"Return a header value as a string\n\n        Args:\n            name: Header name, case-insensitive (e.g., 'Content-Type')\n            default: Value to return in case the header is not\n              found (default None)\n            required: Set to True to raise HttpBadRequest instead\n              of returning gracefully when the header is not found\n              (default False)\n\n        \"\"\"\n\n        # Use try..except to optimize for the header existing in most cases\n        try:\n            # Don't take the time to cache beforehand, using HTTP naming.\n            # This will be faster, assuming that most headers are looked\n            # up only once, and not all headers will be requested.\n            return self._headers[name.upper().replace('-', '_')]\n        except KeyError:\n            if not required:\n                return default\n\n            raise HTTPBadRequest('Missing header',\n                                 'The \"' + name + '\" header is required.')\n\n    def get_param(self, name, default=None, required=False):\n        \"\"\"Return the value of a query string parameter as a string\n\n        Args:\n            name: Parameter name, case-sensitive (e.g., 'sort')\n            default: Value to return in case the parameter is not found in the\n                query string (default None)\n            required: Set to True to raise HTTPBadRequest instead of returning\n                gracefully when the parameter is not found (default False)\n\n        Returns:\n            The value of the param as a byte string, or the default value if\n            param is not found and is not required.\n\n        Raises\n            HTTPBadRequest: The param was not found in the request, but was\n                required.\n\n        \"\"\"\n\n        # PERF: Use if..in since it is a good all-around performer; we don't\n        #       know how likely params are to be specified by clients.\n        if name in self._params:\n            return self._params[name]\n\n        if not required:\n            return default\n\n        raise HTTPBadRequest('Missing query parameter',\n                             'The \"' + name + '\" query parameter is required.')\n\n    def get_param_as_int(self, name, default=None, required=False):\n        \"\"\"Return the value of a query string parameter as an int\n\n        Args:\n            name: Parameter name, case-sensitive (e.g., 'limit')\n            default: Value to return in case the parameter is not found in the\n                query string, or it is not an integer (default None)\n            required: Set to True to raise HTTPBadRequest instead of returning\n                gracefully when the parameter is not found or is not an\n                integer (default False)\n\n        Returns:\n            The value of the param if it is found and can be converted to an\n            integer. Otherwise, returns the default value unless required is\n            True.\n\n        Raises\n            HTTPBadRequest: The param was not found in the request, but was\n                required.\n\n        \"\"\"\n\n        # PERF: Use if..in since it is a good all-around performer; we don't\n        #       know how likely params are to be specified by clients.\n        if name in self._params:\n            val = self._params[name]\n            try:\n                return int(val)\n            except ValueError:\n                pass\n\n        if not required:\n            return default\n\n        raise HTTPBadRequest('Missing query parameter',\n                             'The \"' + name + '\" query parameter is required.')\n", "path": "falcon/request.py"}], "after_files": [{"content": "\"\"\"Defines the Request class.\n\nCopyright 2013 by Rackspace Hosting, Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\n\"\"\"\n\nfrom datetime import datetime\n\nimport six\n\nfrom falcon.request_helpers import *\nfrom falcon.exceptions import *\n\nDEFAULT_ERROR_LOG_FORMAT = ('{0:%Y-%m-%d %H:%M:%S} [FALCON] [ERROR]'\n                            ' {1} {2}?{3} => {4}\\n')\n\n\nclass Request(object):\n    \"\"\"Represents a client's HTTP request\"\"\"\n\n    __slots__ = (\n        'app',\n        '_headers',\n        'method',\n        '_params',\n        'path',\n        'protocol',\n        'query_string',\n        'stream',\n        '_wsgierrors'\n    )\n\n    def __init__(self, env):\n        \"\"\"Initialize attributes based on a WSGI environment dict\n\n        Note: Request is not meant to be instantiated directory by responders.\n\n        Args:\n            env: A WSGI environment dict passed in from the server. See also\n                the PEP-333 spec.\n\n        \"\"\"\n\n        self._wsgierrors = env['wsgi.errors']\n        self.stream = env['wsgi.input']\n\n        self.protocol = env['wsgi.url_scheme']\n        self.app = env['SCRIPT_NAME']\n        self.method = env['REQUEST_METHOD']\n        self.path = env['PATH_INFO'] or '/'\n        self.query_string = query_string = env['QUERY_STRING']\n\n        self._params = parse_query_string(query_string)\n        self._headers = parse_headers(env)\n\n    def log_error(self, message):\n        \"\"\"Log an error to wsgi.error\n\n        Prepends timestamp and request info to message, and writes the\n        result out to the WSGI server's error stream (wsgi.error).\n\n        Args:\n            message: A string describing the problem. If a byte-string and\n                running under Python 2, the string is assumed to be encoded\n                as UTF-8.\n\n        \"\"\"\n        if not six.PY3 and isinstance(message, unicode):\n            message = message.encode('utf-8')\n\n        log_line = (\n            DEFAULT_ERROR_LOG_FORMAT.\n            format(datetime.now(), self.method, self.path,\n                   self.query_string, message)\n        )\n\n        self._wsgierrors.write(log_line)\n\n    def client_accepts_json(self):\n        \"\"\"Return True if the Accept header indicates JSON support\"\"\"\n\n        accept = self.get_header('Accept')\n        if accept is not None:\n            return ('application/json' in accept) or ('*/*' in accept)\n\n        return False\n\n    def get_header(self, name, default=None, required=False):\n        \"\"\"Return a header value as a string\n\n        Args:\n            name: Header name, case-insensitive (e.g., 'Content-Type')\n            default: Value to return in case the header is not\n              found (default None)\n            required: Set to True to raise HttpBadRequest instead\n              of returning gracefully when the header is not found\n              (default False)\n\n        \"\"\"\n\n        # Use try..except to optimize for the header existing in most cases\n        try:\n            # Don't take the time to cache beforehand, using HTTP naming.\n            # This will be faster, assuming that most headers are looked\n            # up only once, and not all headers will be requested.\n            return self._headers[name.upper().replace('-', '_')]\n        except KeyError:\n            if not required:\n                return default\n\n            raise HTTPBadRequest('Missing header',\n                                 'The \"' + name + '\" header is required.')\n\n    def get_param(self, name, default=None, required=False):\n        \"\"\"Return the value of a query string parameter as a string\n\n        Args:\n            name: Parameter name, case-sensitive (e.g., 'sort')\n            default: Value to return in case the parameter is not found in the\n                query string (default None)\n            required: Set to True to raise HTTPBadRequest instead of returning\n                gracefully when the parameter is not found (default False)\n\n        Returns:\n            The value of the param as a byte string, or the default value if\n            param is not found and is not required.\n\n        Raises\n            HTTPBadRequest: The param was not found in the request, but was\n                required.\n\n        \"\"\"\n\n        # PERF: Use if..in since it is a good all-around performer; we don't\n        #       know how likely params are to be specified by clients.\n        if name in self._params:\n            return self._params[name]\n\n        if not required:\n            return default\n\n        raise HTTPBadRequest('Missing query parameter',\n                             'The \"' + name + '\" query parameter is required.')\n\n    def get_param_as_int(self, name, default=None, required=False):\n        \"\"\"Return the value of a query string parameter as an int\n\n        Args:\n            name: Parameter name, case-sensitive (e.g., 'limit')\n            default: Value to return in case the parameter is not found in the\n                query string, or it is not an integer (default None)\n            required: Set to True to raise HTTPBadRequest instead of returning\n                gracefully when the parameter is not found or is not an\n                integer (default False)\n\n        Returns:\n            The value of the param if it is found and can be converted to an\n            integer. Otherwise, returns the default value unless required is\n            True.\n\n        Raises\n            HTTPBadRequest: The param was not found in the request, but was\n                required.\n\n        \"\"\"\n\n        # PERF: Use if..in since it is a good all-around performer; we don't\n        #       know how likely params are to be specified by clients.\n        if name in self._params:\n            val = self._params[name]\n            try:\n                return int(val)\n            except ValueError:\n                pass\n\n        if not required:\n            return default\n\n        raise HTTPBadRequest('Missing query parameter',\n                             'The \"' + name + '\" query parameter is required.')\n", "path": "falcon/request.py"}]}