prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Incorrect response content-type header from cloudwatch logs
  When using the .NET AWSSDK connected to localstack and querying cloudwatch logs e.g. 
   var logClient = new AmazonCloudWatchLogsClient(new AmazonCloudWatchLogsConfig()
              {
                  ServiceURL = "http://localhost:4586",
                  UseHttp = true,
                  AuthenticationRegion = "eu-central-1",
              });
              var logGroupName = @"/aws/lambda/f1";
              var events = logClient.FilterLogEventsAsync(new FilterLogEventsRequest()
              {
                  LogGroupName = logGroupName,
              }).GetAwaiter().GetResult();
  
  The response is returned from the server but cannot be parsed by the SDK client code because the response's content-type header is text/html when it should be application/x-amz-json-1.1.  This confirmed using Fiddler traces comparing the response from localstack to the response from AWS in the cloud. Can this be fixed easily?
  
  </issue>
  <code>
  [start of localstack/services/logs/logs_listener.py]
  1 import re
  2 from requests.models import Request
  3 from localstack.utils.common import to_str
  4 from localstack.services.generic_proxy import ProxyListener
  5 
  6 
  7 class ProxyListenerCloudWatchLogs(ProxyListener):
  8 
  9     def forward_request(self, method, path, data, headers):
  10         if method == 'POST' and path == '/':
  11             if 'nextToken' in to_str(data or ''):
  12                 data = self._fix_next_token_request(data)
  13                 headers['content-length'] = str(len(data))
  14                 return Request(data=data, headers=headers, method=method)
  15 
  16         return True
  17 
  18     def return_response(self, method, path, data, headers, response):
  19         if 'nextToken' in to_str(response.content or ''):
  20             self._fix_next_token_response(response)
  21             response.headers['content-length'] = str(len(response._content))
  22 
  23     def _fix_next_token_request(self, data):
  24         # Fix for https://github.com/localstack/localstack/issues/1527
  25         pattern = r'"nextToken":\s*"([0-9]+)"'
  26         replacement = r'"nextToken": \1'
  27         return re.sub(pattern, replacement, to_str(data))
  28 
  29     def _fix_next_token_response(self, response):
  30         # Fix for https://github.com/localstack/localstack/issues/1527
  31         pattern = r'"nextToken":\s*([0-9]+)'
  32         replacement = r'"nextToken": "\1"'
  33         response._content = re.sub(pattern, replacement, to_str(response.content))
  34 
  35 
  36 # instantiate listener
  37 UPDATE_LOGS = ProxyListenerCloudWatchLogs()
  38
  [end of localstack/services/logs/logs_listener.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/localstack/services/logs/logs_listener.py b/localstack/services/logs/logs_listener.py
  --- a/localstack/services/logs/logs_listener.py
  +++ b/localstack/services/logs/logs_listener.py
  @@ -1,11 +1,11 @@
   import re
   from requests.models import Request
   from localstack.utils.common import to_str
  +from localstack.constants import APPLICATION_AMZ_JSON_1_1
   from localstack.services.generic_proxy import ProxyListener
   
   
   class ProxyListenerCloudWatchLogs(ProxyListener):
  -
       def forward_request(self, method, path, data, headers):
           if method == 'POST' and path == '/':
               if 'nextToken' in to_str(data or ''):
  @@ -16,17 +16,22 @@
           return True
   
       def return_response(self, method, path, data, headers, response):
  +        # Fix Incorrect response content-type header from cloudwatch logs #1343
  +        response.headers['content-type'] = APPLICATION_AMZ_JSON_1_1
  +
           if 'nextToken' in to_str(response.content or ''):
               self._fix_next_token_response(response)
               response.headers['content-length'] = str(len(response._content))
   
  -    def _fix_next_token_request(self, data):
  +    @staticmethod
  +    def _fix_next_token_request(data):
           # Fix for https://github.com/localstack/localstack/issues/1527
           pattern = r'"nextToken":\s*"([0-9]+)"'
           replacement = r'"nextToken": \1'
           return re.sub(pattern, replacement, to_str(data))
   
  -    def _fix_next_token_response(self, response):
  +    @staticmethod
  +    def _fix_next_token_response(response):
           # Fix for https://github.com/localstack/localstack/issues/1527
           pattern = r'"nextToken":\s*([0-9]+)'
           replacement = r'"nextToken": "\1"'
  
verification_info: {"golden_diff": "diff --git a/localstack/services/logs/logs_listener.py b/localstack/services/logs/logs_listener.py\n--- a/localstack/services/logs/logs_listener.py\n+++ b/localstack/services/logs/logs_listener.py\n@@ -1,11 +1,11 @@\n import re\n from requests.models import Request\n from localstack.utils.common import to_str\n+from localstack.constants import APPLICATION_AMZ_JSON_1_1\n from localstack.services.generic_proxy import ProxyListener\n \n \n class ProxyListenerCloudWatchLogs(ProxyListener):\n-\n     def forward_request(self, method, path, data, headers):\n         if method == 'POST' and path == '/':\n             if 'nextToken' in to_str(data or ''):\n@@ -16,17 +16,22 @@\n         return True\n \n     def return_response(self, method, path, data, headers, response):\n+        # Fix Incorrect response content-type header from cloudwatch logs #1343\n+        response.headers['content-type'] = APPLICATION_AMZ_JSON_1_1\n+\n         if 'nextToken' in to_str(response.content or ''):\n             self._fix_next_token_response(response)\n             response.headers['content-length'] = str(len(response._content))\n \n-    def _fix_next_token_request(self, data):\n+    @staticmethod\n+    def _fix_next_token_request(data):\n         # Fix for https://github.com/localstack/localstack/issues/1527\n         pattern = r'\"nextToken\":\\s*\"([0-9]+)\"'\n         replacement = r'\"nextToken\": \\1'\n         return re.sub(pattern, replacement, to_str(data))\n \n-    def _fix_next_token_response(self, response):\n+    @staticmethod\n+    def _fix_next_token_response(response):\n         # Fix for https://github.com/localstack/localstack/issues/1527\n         pattern = r'\"nextToken\":\\s*([0-9]+)'\n         replacement = r'\"nextToken\": \"\\1\"'\n", "issue": "Incorrect response content-type header from cloudwatch logs\nWhen using the .NET AWSSDK connected to localstack and querying cloudwatch logs e.g. \r\n var logClient = new AmazonCloudWatchLogsClient(new AmazonCloudWatchLogsConfig()\r\n            {\r\n                ServiceURL = \"http://localhost:4586\",\r\n                UseHttp = true,\r\n                AuthenticationRegion = \"eu-central-1\",\r\n            });\r\n            var logGroupName = @\"/aws/lambda/f1\";\r\n            var events = logClient.FilterLogEventsAsync(new FilterLogEventsRequest()\r\n            {\r\n                LogGroupName = logGroupName,\r\n            }).GetAwaiter().GetResult();\r\n\r\nThe response is returned from the server but cannot be parsed by the SDK client code because the response's content-type header is text/html when it should be application/x-amz-json-1.1.  This confirmed using Fiddler traces comparing the response from localstack to the response from AWS in the cloud. Can this be fixed easily?\n", "before_files": [{"content": "import re\nfrom requests.models import Request\nfrom localstack.utils.common import to_str\nfrom localstack.services.generic_proxy import ProxyListener\n\n\nclass ProxyListenerCloudWatchLogs(ProxyListener):\n\n    def forward_request(self, method, path, data, headers):\n        if method == 'POST' and path == '/':\n            if 'nextToken' in to_str(data or ''):\n                data = self._fix_next_token_request(data)\n                headers['content-length'] = str(len(data))\n                return Request(data=data, headers=headers, method=method)\n\n        return True\n\n    def return_response(self, method, path, data, headers, response):\n        if 'nextToken' in to_str(response.content or ''):\n            self._fix_next_token_response(response)\n            response.headers['content-length'] = str(len(response._content))\n\n    def _fix_next_token_request(self, data):\n        # Fix for https://github.com/localstack/localstack/issues/1527\n        pattern = r'\"nextToken\":\\s*\"([0-9]+)\"'\n        replacement = r'\"nextToken\": \\1'\n        return re.sub(pattern, replacement, to_str(data))\n\n    def _fix_next_token_response(self, response):\n        # Fix for https://github.com/localstack/localstack/issues/1527\n        pattern = r'\"nextToken\":\\s*([0-9]+)'\n        replacement = r'\"nextToken\": \"\\1\"'\n        response._content = re.sub(pattern, replacement, to_str(response.content))\n\n\n# instantiate listener\nUPDATE_LOGS = ProxyListenerCloudWatchLogs()\n", "path": "localstack/services/logs/logs_listener.py"}]}