We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Add content-type header for Acoustic Transact requests
Transact customers using Oauth for submissions should add header: 

`Content-Type : text/plain` or 
`Content-Type : text/xml`


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `basket/news/backends/acoustic.py`
Content:
```
1 import logging
2 
3 from django.conf import settings
4 from django.utils.encoding import force_bytes
5 
6 from lxml import etree
7 from requests import ConnectionError
8 from silverpop.api import Silverpop, SilverpopResponseException
9 
10 logger = logging.getLogger(__name__)
11 XML_HEADER = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'
12 
13 
14 def process_response(resp):
15     logger.debug("Response: %s" % resp.text)
16     response = etree.fromstring(resp.text.encode("utf-8"))
17     failure = response.find(".//FAILURES/FAILURE")
18     if failure:
19         raise SilverpopResponseException(failure.attrib["description"])
20 
21     fault = response.find(".//Fault/FaultString")
22     if fault:
23         raise SilverpopResponseException(fault.text)
24 
25     return response
26 
27 
28 def process_tx_response(resp):
29     logger.debug("Response: %s" % resp.text)
30     response = etree.fromstring(resp.text.encode("utf-8"))
31     errors = response.findall(".//ERROR_STRING")
32     if errors:
33         for e in errors:
34             if e.text:
35                 raise SilverpopResponseException(e.text)
36 
37     return response
38 
39 
40 def xml_tag(tag, value=None, cdata=False, **attrs):
41     xmlt = etree.Element(tag, attrs)
42     if value:
43         if cdata:
44             xmlt.text = etree.CDATA(value)
45         else:
46             xmlt.text = value
47 
48     return xmlt
49 
50 
51 def transact_xml(to, campaign_id, fields=None, bcc=None, save_to_db=False):
52     fields = fields or {}
53     bcc = bcc or []
54     if isinstance(bcc, str):
55         bcc = [bcc]
56 
57     root = xml_tag("XTMAILING")
58     root.append(xml_tag("CAMPAIGN_ID", campaign_id))
59     if "transaction_id" in fields:
60         root.append(xml_tag("TRANSACTION_ID", fields["transaction_id"]))
61 
62     root.append(xml_tag("SEND_AS_BATCH", "false"))
63     root.append(xml_tag("NO_RETRY_ON_FAILURE", "false"))
64     if fields and save_to_db:
65         save_cols_tag = xml_tag("SAVE_COLUMNS")
66         root.append(save_cols_tag)
67         for name in fields:
68             save_cols_tag.append(xml_tag("COLUMN_NAME", name))
69 
70     recipient_tag = xml_tag("RECIPIENT")
71     root.append(recipient_tag)
72     recipient_tag.append(xml_tag("EMAIL", to))
73     for addr in bcc:
74         recipient_tag.append(xml_tag("BCC", addr))
75     recipient_tag.append(xml_tag("BODY_TYPE", "HTML"))
76     for name, value in fields.items():
77         p_tag = xml_tag("PERSONALIZATION")
78         p_tag.append(xml_tag("TAG_NAME", name))
79         p_tag.append(xml_tag("VALUE", value))
80         recipient_tag.append(p_tag)
81 
82     return XML_HEADER + etree.tostring(root, encoding="unicode")
83 
84 
85 class Acoustic(Silverpop):
86     def _call(self, xml):
87         logger.debug("Request: %s" % xml)
88         try:
89             response = self.session.post(
90                 self.api_endpoint,
91                 data=force_bytes(xml),
92                 timeout=10,
93             )
94         except ConnectionError:
95             # try one more time
96             response = self.session.post(
97                 self.api_endpoint,
98                 data=force_bytes(xml),
99                 timeout=10,
100             )
101 
102         return process_response(response)
103 
104 
105 class AcousticTransact(Silverpop):
106     api_xt_endpoint = "https://transact-campaign-us-%s.goacoustic.com/XTMail"
107 
108     def __init__(self, client_id, client_secret, refresh_token, server_number):
109         self.api_xt_endpoint = self.api_xt_endpoint % server_number
110         super().__init__(client_id, client_secret, refresh_token, server_number)
111 
112     def _call_xt(self, xml):
113         logger.debug("Request: %s" % xml)
114         response = self.session.post(
115             self.api_xt_endpoint,
116             data=force_bytes(xml),
117             timeout=10,
118         )
119         return process_tx_response(response)
120 
121     def send_mail(self, to, campaign_id, fields=None, bcc=None, save_to_db=False):
122         self._call_xt(transact_xml(to, campaign_id, fields, bcc, save_to_db))
123 
124 
125 acoustic = Acoustic(
126     client_id=settings.ACOUSTIC_CLIENT_ID,
127     client_secret=settings.ACOUSTIC_CLIENT_SECRET,
128     refresh_token=settings.ACOUSTIC_REFRESH_TOKEN,
129     server_number=settings.ACOUSTIC_SERVER_NUMBER,
130 )
131 acoustic_tx = AcousticTransact(
132     client_id=settings.ACOUSTIC_TX_CLIENT_ID,
133     client_secret=settings.ACOUSTIC_TX_CLIENT_SECRET,
134     refresh_token=settings.ACOUSTIC_TX_REFRESH_TOKEN,
135     server_number=settings.ACOUSTIC_TX_SERVER_NUMBER,
136 )
137
```
--- 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/basket/news/backends/acoustic.py b/basket/news/backends/acoustic.py
--- a/basket/news/backends/acoustic.py
+++ b/basket/news/backends/acoustic.py
@@ -90,6 +90,7 @@
                 self.api_endpoint,
                 data=force_bytes(xml),
                 timeout=10,
+                headers={"Content-Type": "text/xml"},
             )
         except ConnectionError:
             # try one more time
@@ -97,6 +98,7 @@
                 self.api_endpoint,
                 data=force_bytes(xml),
                 timeout=10,
+                headers={"Content-Type": "text/xml"},
             )
 
         return process_response(response)
@@ -115,6 +117,7 @@
             self.api_xt_endpoint,
             data=force_bytes(xml),
             timeout=10,
+            headers={"Content-Type": "text/xml"},
         )
         return process_tx_response(response)

{"golden_diff": "diff --git a/basket/news/backends/acoustic.py b/basket/news/backends/acoustic.py\n--- a/basket/news/backends/acoustic.py\n+++ b/basket/news/backends/acoustic.py\n@@ -90,6 +90,7 @@\n                 self.api_endpoint,\n                 data=force_bytes(xml),\n                 timeout=10,\n+                headers={\"Content-Type\": \"text/xml\"},\n             )\n         except ConnectionError:\n             # try one more time\n@@ -97,6 +98,7 @@\n                 self.api_endpoint,\n                 data=force_bytes(xml),\n                 timeout=10,\n+                headers={\"Content-Type\": \"text/xml\"},\n             )\n \n         return process_response(response)\n@@ -115,6 +117,7 @@\n             self.api_xt_endpoint,\n             data=force_bytes(xml),\n             timeout=10,\n+            headers={\"Content-Type\": \"text/xml\"},\n         )\n         return process_tx_response(response)\n", "issue": "Add content-type header for Acoustic Transact requests\nTransact customers using Oauth for submissions should add header: \r\n\r\n`Content-Type : text/plain` or \r\n`Content-Type : text/xml`\r\n\n", "before_files": [{"content": "import logging\n\nfrom django.conf import settings\nfrom django.utils.encoding import force_bytes\n\nfrom lxml import etree\nfrom requests import ConnectionError\nfrom silverpop.api import Silverpop, SilverpopResponseException\n\nlogger = logging.getLogger(__name__)\nXML_HEADER = '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>'\n\n\ndef process_response(resp):\n    logger.debug(\"Response: %s\" % resp.text)\n    response = etree.fromstring(resp.text.encode(\"utf-8\"))\n    failure = response.find(\".//FAILURES/FAILURE\")\n    if failure:\n        raise SilverpopResponseException(failure.attrib[\"description\"])\n\n    fault = response.find(\".//Fault/FaultString\")\n    if fault:\n        raise SilverpopResponseException(fault.text)\n\n    return response\n\n\ndef process_tx_response(resp):\n    logger.debug(\"Response: %s\" % resp.text)\n    response = etree.fromstring(resp.text.encode(\"utf-8\"))\n    errors = response.findall(\".//ERROR_STRING\")\n    if errors:\n        for e in errors:\n            if e.text:\n                raise SilverpopResponseException(e.text)\n\n    return response\n\n\ndef xml_tag(tag, value=None, cdata=False, **attrs):\n    xmlt = etree.Element(tag, attrs)\n    if value:\n        if cdata:\n            xmlt.text = etree.CDATA(value)\n        else:\n            xmlt.text = value\n\n    return xmlt\n\n\ndef transact_xml(to, campaign_id, fields=None, bcc=None, save_to_db=False):\n    fields = fields or {}\n    bcc = bcc or []\n    if isinstance(bcc, str):\n        bcc = [bcc]\n\n    root = xml_tag(\"XTMAILING\")\n    root.append(xml_tag(\"CAMPAIGN_ID\", campaign_id))\n    if \"transaction_id\" in fields:\n        root.append(xml_tag(\"TRANSACTION_ID\", fields[\"transaction_id\"]))\n\n    root.append(xml_tag(\"SEND_AS_BATCH\", \"false\"))\n    root.append(xml_tag(\"NO_RETRY_ON_FAILURE\", \"false\"))\n    if fields and save_to_db:\n        save_cols_tag = xml_tag(\"SAVE_COLUMNS\")\n        root.append(save_cols_tag)\n        for name in fields:\n            save_cols_tag.append(xml_tag(\"COLUMN_NAME\", name))\n\n    recipient_tag = xml_tag(\"RECIPIENT\")\n    root.append(recipient_tag)\n    recipient_tag.append(xml_tag(\"EMAIL\", to))\n    for addr in bcc:\n        recipient_tag.append(xml_tag(\"BCC\", addr))\n    recipient_tag.append(xml_tag(\"BODY_TYPE\", \"HTML\"))\n    for name, value in fields.items():\n        p_tag = xml_tag(\"PERSONALIZATION\")\n        p_tag.append(xml_tag(\"TAG_NAME\", name))\n        p_tag.append(xml_tag(\"VALUE\", value))\n        recipient_tag.append(p_tag)\n\n    return XML_HEADER + etree.tostring(root, encoding=\"unicode\")\n\n\nclass Acoustic(Silverpop):\n    def _call(self, xml):\n        logger.debug(\"Request: %s\" % xml)\n        try:\n            response = self.session.post(\n                self.api_endpoint,\n                data=force_bytes(xml),\n                timeout=10,\n            )\n        except ConnectionError:\n            # try one more time\n            response = self.session.post(\n                self.api_endpoint,\n                data=force_bytes(xml),\n                timeout=10,\n            )\n\n        return process_response(response)\n\n\nclass AcousticTransact(Silverpop):\n    api_xt_endpoint = \"https://transact-campaign-us-%s.goacoustic.com/XTMail\"\n\n    def __init__(self, client_id, client_secret, refresh_token, server_number):\n        self.api_xt_endpoint = self.api_xt_endpoint % server_number\n        super().__init__(client_id, client_secret, refresh_token, server_number)\n\n    def _call_xt(self, xml):\n        logger.debug(\"Request: %s\" % xml)\n        response = self.session.post(\n            self.api_xt_endpoint,\n            data=force_bytes(xml),\n            timeout=10,\n        )\n        return process_tx_response(response)\n\n    def send_mail(self, to, campaign_id, fields=None, bcc=None, save_to_db=False):\n        self._call_xt(transact_xml(to, campaign_id, fields, bcc, save_to_db))\n\n\nacoustic = Acoustic(\n    client_id=settings.ACOUSTIC_CLIENT_ID,\n    client_secret=settings.ACOUSTIC_CLIENT_SECRET,\n    refresh_token=settings.ACOUSTIC_REFRESH_TOKEN,\n    server_number=settings.ACOUSTIC_SERVER_NUMBER,\n)\nacoustic_tx = AcousticTransact(\n    client_id=settings.ACOUSTIC_TX_CLIENT_ID,\n    client_secret=settings.ACOUSTIC_TX_CLIENT_SECRET,\n    refresh_token=settings.ACOUSTIC_TX_REFRESH_TOKEN,\n    server_number=settings.ACOUSTIC_TX_SERVER_NUMBER,\n)\n", "path": "basket/news/backends/acoustic.py"}], "after_files": [{"content": "import logging\n\nfrom django.conf import settings\nfrom django.utils.encoding import force_bytes\n\nfrom lxml import etree\nfrom requests import ConnectionError\nfrom silverpop.api import Silverpop, SilverpopResponseException\n\nlogger = logging.getLogger(__name__)\nXML_HEADER = '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>'\n\n\ndef process_response(resp):\n    logger.debug(\"Response: %s\" % resp.text)\n    response = etree.fromstring(resp.text.encode(\"utf-8\"))\n    failure = response.find(\".//FAILURES/FAILURE\")\n    if failure:\n        raise SilverpopResponseException(failure.attrib[\"description\"])\n\n    fault = response.find(\".//Fault/FaultString\")\n    if fault:\n        raise SilverpopResponseException(fault.text)\n\n    return response\n\n\ndef process_tx_response(resp):\n    logger.debug(\"Response: %s\" % resp.text)\n    response = etree.fromstring(resp.text.encode(\"utf-8\"))\n    errors = response.findall(\".//ERROR_STRING\")\n    if errors:\n        for e in errors:\n            if e.text:\n                raise SilverpopResponseException(e.text)\n\n    return response\n\n\ndef xml_tag(tag, value=None, cdata=False, **attrs):\n    xmlt = etree.Element(tag, attrs)\n    if value:\n        if cdata:\n            xmlt.text = etree.CDATA(value)\n        else:\n            xmlt.text = value\n\n    return xmlt\n\n\ndef transact_xml(to, campaign_id, fields=None, bcc=None, save_to_db=False):\n    fields = fields or {}\n    bcc = bcc or []\n    if isinstance(bcc, str):\n        bcc = [bcc]\n\n    root = xml_tag(\"XTMAILING\")\n    root.append(xml_tag(\"CAMPAIGN_ID\", campaign_id))\n    if \"transaction_id\" in fields:\n        root.append(xml_tag(\"TRANSACTION_ID\", fields[\"transaction_id\"]))\n\n    root.append(xml_tag(\"SEND_AS_BATCH\", \"false\"))\n    root.append(xml_tag(\"NO_RETRY_ON_FAILURE\", \"false\"))\n    if fields and save_to_db:\n        save_cols_tag = xml_tag(\"SAVE_COLUMNS\")\n        root.append(save_cols_tag)\n        for name in fields:\n            save_cols_tag.append(xml_tag(\"COLUMN_NAME\", name))\n\n    recipient_tag = xml_tag(\"RECIPIENT\")\n    root.append(recipient_tag)\n    recipient_tag.append(xml_tag(\"EMAIL\", to))\n    for addr in bcc:\n        recipient_tag.append(xml_tag(\"BCC\", addr))\n    recipient_tag.append(xml_tag(\"BODY_TYPE\", \"HTML\"))\n    for name, value in fields.items():\n        p_tag = xml_tag(\"PERSONALIZATION\")\n        p_tag.append(xml_tag(\"TAG_NAME\", name))\n        p_tag.append(xml_tag(\"VALUE\", value))\n        recipient_tag.append(p_tag)\n\n    return XML_HEADER + etree.tostring(root, encoding=\"unicode\")\n\n\nclass Acoustic(Silverpop):\n    def _call(self, xml):\n        logger.debug(\"Request: %s\" % xml)\n        try:\n            response = self.session.post(\n                self.api_endpoint,\n                data=force_bytes(xml),\n                timeout=10,\n                headers={\"Content-Type\": \"text/xml\"},\n            )\n        except ConnectionError:\n            # try one more time\n            response = self.session.post(\n                self.api_endpoint,\n                data=force_bytes(xml),\n                timeout=10,\n                headers={\"Content-Type\": \"text/xml\"},\n            )\n\n        return process_response(response)\n\n\nclass AcousticTransact(Silverpop):\n    api_xt_endpoint = \"https://transact-campaign-us-%s.goacoustic.com/XTMail\"\n\n    def __init__(self, client_id, client_secret, refresh_token, server_number):\n        self.api_xt_endpoint = self.api_xt_endpoint % server_number\n        super().__init__(client_id, client_secret, refresh_token, server_number)\n\n    def _call_xt(self, xml):\n        logger.debug(\"Request: %s\" % xml)\n        response = self.session.post(\n            self.api_xt_endpoint,\n            data=force_bytes(xml),\n            timeout=10,\n            headers={\"Content-Type\": \"text/xml\"},\n        )\n        return process_tx_response(response)\n\n    def send_mail(self, to, campaign_id, fields=None, bcc=None, save_to_db=False):\n        self._call_xt(transact_xml(to, campaign_id, fields, bcc, save_to_db))\n\n\nacoustic = Acoustic(\n    client_id=settings.ACOUSTIC_CLIENT_ID,\n    client_secret=settings.ACOUSTIC_CLIENT_SECRET,\n    refresh_token=settings.ACOUSTIC_REFRESH_TOKEN,\n    server_number=settings.ACOUSTIC_SERVER_NUMBER,\n)\nacoustic_tx = AcousticTransact(\n    client_id=settings.ACOUSTIC_TX_CLIENT_ID,\n    client_secret=settings.ACOUSTIC_TX_CLIENT_SECRET,\n    refresh_token=settings.ACOUSTIC_TX_REFRESH_TOKEN,\n    server_number=settings.ACOUSTIC_TX_SERVER_NUMBER,\n)\n", "path": "basket/news/backends/acoustic.py"}]}