This commit is contained in:
bvn13 2024-10-11 23:08:51 +03:00
parent 623f63c18c
commit fa005f6366
2 changed files with 5 additions and 3 deletions

4
.gitignore vendored
View File

@ -1,3 +1,5 @@
.idea
.idea/**
local.env
**/*.pyc
test/
test/

View File

@ -48,7 +48,7 @@ class RequireJSON:
)
if req.method in ('POST', 'PUT'):
if req.content_type == None or 'application/json' not in req.content_type:
if req.content_type is None or 'application/json' not in req.content_type:
raise falcon.HTTPUnsupportedMediaType(
title='This API only supports requests encoded as JSON.',
href='http://docs.examples.com/api/json',
@ -158,7 +158,7 @@ class CreateTaskResource:
is_waiting_empty_line = False
with open(file_path, 'r', encoding='UTF-8') as file:
while line := file.readline():
if section_found == False:
if not section_found:
if line.strip() == CreateTaskResource.TODO_HEADER:
section_found = True
is_waiting_empty_line = True