Skip to content

Commit

Permalink
SanitizedEnvironHeaders now need get() implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
johanlundberg committed Dec 2, 2024
1 parent 75c1ae8 commit 530174d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/eduid/webapp/common/api/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,15 @@ def __iter__(self) -> Iterator[tuple[str, str]]: # type: ignore[override]
for key, value in EnvironHeaders.__iter__(self):
yield key, self.sanitize_input(untrusted_text=value, content_type=self.content_type)

def get(self, key: str, default: str | None = None, type: Callable[[str], str | None] | None = None) -> str | None: # type: ignore[override]
"""
Sanitized get
"""
val = super().get(key=key, default=default, type=type) # type: ignore[arg-type]
if val is None:
return None
return self.sanitize_input(untrusted_text=val, content_type=self.content_type)


class Request(FlaskRequest, SanitationMixin):
"""
Expand Down

0 comments on commit 530174d

Please sign in to comment.