Skip to content

Commit

Permalink
Merge pull request #70 from DostEducation/fix/add-content-type-header…
Browse files Browse the repository at this point in the history
…-check-in-request-handling

Add content type header check while handling request
  • Loading branch information
Sachinbisht27 authored Jan 12, 2024
2 parents 18b195e + b0427ff commit 0bfbe97
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/[email protected]
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.9'
- uses: pre-commit/[email protected]
12 changes: 10 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,17 @@


def callback(request):
json_data = None
form_data = None

if request.method == "POST":
json_data = request.get_json()
form_data = request.form
content_type = request.headers.get("Content-Type")

if content_type == "application/json":
json_data = request.get_json()
else:
form_data = request.form

transaction_log_service = services.TransactionLogService()

try:
Expand Down

0 comments on commit 0bfbe97

Please sign in to comment.