Skip to content

Commit

Permalink
fix(x3): content type missing charset
Browse files Browse the repository at this point in the history
Fix missing charset on Content Type HTTP header when integrating to Sage X3.

fix #309
  • Loading branch information
igobranco committed Jul 11, 2024
1 parent 99a7647 commit 5ddac62
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apps/billing/services/processor_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def send_transaction_to_processor(self) -> dict:
response = requests.post(
url=self.__processor_url,
data=self.data,
headers={"Content-type": "application/xml", "SOAPAction": "''"},
headers={"Content-type": "application/xml; charset=utf-8", "SOAPAction": "''"},
auth=(
self.__user_processor_auth,
self.__user_processor_password,
Expand Down
2 changes: 1 addition & 1 deletion apps/billing/tests/test_sagex3_processor_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_send_transaction_to_processor_header_content_type(self, mock_data, mock
SageX3Processor(None).send_transaction_to_processor()
_, kwargs = mock_post.call_args
called_headers = kwargs["headers"]
self.assertEqual("application/xml", called_headers["Content-type"])
self.assertEqual("application/xml; charset=utf-8", called_headers["Content-type"])

@mock.patch("requests.post", return_value=MockResponse(data="", status_code=200))
@mock.patch("apps.billing.services.processor_service.SageX3Processor.data", side_effect=lambda: {"some": "thing"})
Expand Down

0 comments on commit 5ddac62

Please sign in to comment.