Skip to content

Commit 83df389

Browse files
Merge pull request #24 from Xaxxis/master
v1.4.1 - fix custom http header config/params not properly applied to the API request
2 parents 11a9f26 + 9823f7c commit 83df389

File tree

7 files changed

+10
-8
lines changed

7 files changed

+10
-8
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ push_to_twine.sh
99
./Pipfile
1010
env/
1111
.DS_STORE
12+
.idea

Maintaining.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
- Install project as local package `pip install -e .`
1313
- Make your code changes
1414
- Increase `version` value on:
15-
- `./setup.py` file
16-
- `./midtransclient/__init__.py` file
15+
- `./setup.py` file
16+
- `./midtransclient/__init__.py` file
17+
- `./midtransclient/http_client.py` file on User-Agent value
1718
- To install the package locally with a symlink `pip install -e .`
1819
- To run test, run `pytest`
1920
- To run specific test, e.g: `pytest -k "test_core_api_charge_fail_401"`

midtransclient/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
from .error_midtrans import MidtransAPIError
55
from .error_midtrans import JSONDecodeError
66

7-
__version__ = '1.4.0'
7+
__version__ = '1.4.1'

midtransclient/http_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def request(self, method, server_key, request_url, parameters=dict(),
3939
default_headers = {
4040
'content-type': 'application/json',
4141
'accept': 'application/json',
42-
'user-agent': 'midtransclient-python/1.2.0'
42+
'user-agent': 'midtransclient-python/1.4.1'
4343
}
4444
headers = default_headers
4545

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
setup(
2222
name="midtransclient",
23-
version="1.4.0",
23+
version="1.4.1",
2424
author="Midtrans - Integration Support Team",
2525
author_email="[email protected]",
2626
license='MIT',

tests/test_http_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def test_is_custom_headers_applied():
6868
custom_headers=custom_headers)
6969

7070
# Fetch the headers from requests.request arguments
71-
headers = mock_request.call_args.kwargs['headers']
71+
headers = mock_request.call_args[1]['headers']
7272

7373
# Make sure default header still exist
7474
assert headers.get('content-type') == 'application/json'

tests/test_snap.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def test_snap_status_fail_404():
5858

5959
def test_snap_request_fail_401():
6060
snap = generate_snap_instance()
61-
snap.api_config.server_key=''
61+
snap.api_config.server_key='dummy'
6262
param = generate_param_min()
6363
err = ''
6464
try:
@@ -94,7 +94,7 @@ def test_snap_request_fail_zero_gross_amount():
9494

9595
def test_snap_exception_MidtransAPIError():
9696
snap = generate_snap_instance()
97-
snap.api_config.server_key=''
97+
snap.api_config.server_key='dummy'
9898
param = generate_param_min()
9999
err = ''
100100
try:

0 commit comments

Comments
 (0)