Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(typing): ensure return type is a str when default_value is set #3840

Merged
merged 1 commit into from
Feb 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import enum
import re
from typing import Any, Dict, List, Optional
from typing import Any, Dict, List, Optional, overload

from aws_lambda_powertools.utilities.data_classes.common import (
BaseRequestContext,
Expand Down Expand Up @@ -162,6 +162,22 @@ def stage_variables(self) -> Dict[str, str]:
def request_context(self) -> BaseRequestContext:
return BaseRequestContext(self._data)

@overload
def get_header_value(
self,
name: str,
default_value: str,
case_sensitive: Optional[bool] = False,
) -> str: ...

@overload
def get_header_value(
self,
name: str,
default_value: Optional[str] = None,
case_sensitive: Optional[bool] = False,
) -> Optional[str]: ...

def get_header_value(
self,
name: str,
Expand Down