Skip to content

Commit

Permalink
Merge pull request #2 from trz42/fix-header
Browse files Browse the repository at this point in the history
fixing KeyError for X-Request-Id header, use X-Github-Delivery for event ID instead
  • Loading branch information
boegel authored Jun 1, 2022
2 parents 1c5b649 + 387ed97 commit 853079b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyghee/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def get_event_info(request):
"""
event_info = {
'action': request.json.get('action', UNKNOWN),
'id': request.headers['X-Request-Id'],
'id': request.headers['X-Github-Delivery'],
'signature-sha1': request.headers['X-Hub-Signature'],
'timestamp_raw': request.headers['Timestamp'],
'type': request.headers['X-GitHub-Event'],
Expand Down
4 changes: 2 additions & 2 deletions tests/event_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
'Timestamp': TIMESTAMP_001,
'X-GitHub-Event': EVENT_TYPE_CREATE,
'X-Hub-Signature': 'sha1=0123456789abcedf0123456789abcedf01234567', # fake signature!
'X-Request-Id': REQUEST_ID_001,
'X-Github-Delivery': REQUEST_ID_001,
}, {
# request.json
'action': ACTION_CREATED,
Expand All @@ -41,7 +41,7 @@
'Timestamp': TIMESTAMP_001,
'X-GitHub-Event': EVENT_TYPE_ISSUE_COMMENT,
'X-Hub-Signature': 'sha1=0123456789abcedf0123456789abcedf01234567', # fake signature!
'X-Request-Id': REQUEST_ID_001,
'X-Github-Delivery': REQUEST_ID_001,
}, {
# request.json
'action': ACTION_CREATED,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def test_process_event(tmpdir):
expected_header = {
'Timestamp': TIMESTAMP_001,
'X-GitHub-Event': event_type,
'X-Request-Id': REQUEST_ID_001,
'X-Github-Delivery': REQUEST_ID_001,
}
with open(os.path.join(event_data_dir, header_fp), 'r') as fp:
header_data = json.load(fp)
Expand Down

0 comments on commit 853079b

Please sign in to comment.