Skip to content

Commit

Permalink
Move function call outside try except block
Browse files Browse the repository at this point in the history
  • Loading branch information
copalco committed Aug 20, 2024
1 parent 7ed2843 commit b374d50
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions falcon/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -1211,8 +1211,8 @@ def get_header_as_int(self, header, required=False):
HttpInvalidHeader: The header contained a malformed/invalid value.
"""

http_int = self.get_header(header, required=required)
try:
http_int = self.get_header(header, required=required)
return int(http_int)
except TypeError:
# When the header does not exist and isn't required
Expand Down Expand Up @@ -1245,8 +1245,8 @@ def get_header_as_datetime(self, header, required=False, obs_date=False):
HttpInvalidHeader: The header contained a malformed/invalid value.
"""

http_date = self.get_header(header, required=required)
try:
http_date = self.get_header(header, required=required)
return util.http_date_to_dt(http_date, obs_date=obs_date)
except TypeError:
# When the header does not exist and isn't required
Expand Down

0 comments on commit b374d50

Please sign in to comment.