Skip to content

Commit 7634b2f

Browse files
refactor(event_handler): promote HttpResolver to stable (#8289)
* refactor: promote HttpResolver to stable * refactor: promote HttpResolver to stable
1 parent 50541fe commit 7634b2f

9 files changed

Lines changed: 18 additions & 37 deletions

File tree

aws_lambda_powertools/event_handler/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
)
1919
from aws_lambda_powertools.event_handler.depends import DependencyResolutionError, Depends
2020
from aws_lambda_powertools.event_handler.events_appsync.appsync_events import AppSyncEventsResolver
21-
from aws_lambda_powertools.event_handler.http_resolver import HttpResolverLocal
21+
from aws_lambda_powertools.event_handler.http_resolver import HttpResolver, HttpResolverLocal
2222
from aws_lambda_powertools.event_handler.lambda_function_url import (
2323
LambdaFunctionUrlResolver,
2424
)
@@ -39,6 +39,7 @@
3939
"CORSConfig",
4040
"Depends",
4141
"DependencyResolutionError",
42+
"HttpResolver",
4243
"HttpResolverLocal",
4344
"LambdaFunctionUrlResolver",
4445
"Request",

aws_lambda_powertools/event_handler/http_resolver.py

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from __future__ import annotations
22

33
import base64
4-
import warnings
54
from typing import TYPE_CHECKING, Any, Callable
65
from urllib.parse import parse_qs
76

@@ -162,21 +161,16 @@ def get_remaining_time_in_millis(self) -> int: # pragma: no cover
162161

163162
class HttpResolverLocal(ApiGatewayResolver):
164163
"""
165-
ASGI-compatible HTTP resolver for local development and testing.
164+
ASGI-compatible HTTP resolver.
166165
167-
This resolver is designed specifically for local development workflows.
168-
It allows you to run your Powertools application locally with any ASGI server
166+
It allows you to run your Powertools application with any ASGI server
169167
(uvicorn, hypercorn, daphne, etc.) while maintaining full compatibility with Lambda.
170168
171169
The same code works in both environments - locally via ASGI and in Lambda via the handler.
170+
If your Lambda is behind Lambda Web Adapter or any other HTTP proxy, it works seamlessly.
172171
173172
Supports both sync and async route handlers.
174173
175-
WARNING
176-
-------
177-
This is intended for local development and testing only.
178-
The API may change in future releases. Do not use in production environments.
179-
180174
Example
181175
-------
182176
```python
@@ -210,11 +204,6 @@ def __init__(
210204
strip_prefixes: list[str | Any] | None = None,
211205
enable_validation: bool = False,
212206
):
213-
warnings.warn(
214-
"HttpResolverLocal is intended for local development and testing only. "
215-
"The API may change in future releases. Do not use in production environments.",
216-
stacklevel=2,
217-
)
218207
super().__init__(
219208
proxy_type=ProxyEventType.APIGatewayProxyEvent, # Use REST API format internally
220209
cors=cors,
@@ -351,3 +340,6 @@ async def _send_response(self, send: Callable, response: dict) -> None:
351340
"body": body_bytes,
352341
},
353342
)
343+
344+
345+
HttpResolver = HttpResolverLocal

docs/core/event_handler/api_gateway.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ By default, we will use `APIGatewayRestResolver` throughout the documentation. Y
6464
| **[`ALBResolver`](#application-load-balancer)** | Amazon Application Load Balancer (ALB) |
6565
| **[`LambdaFunctionUrlResolver`](#lambda-function-url)** | AWS Lambda Function URL |
6666
| **[`VPCLatticeResolver`](#vpc-lattice)** | Amazon VPC Lattice |
67-
| **[`HttpResolverLocal`](#http-resolver-local)** | Local development with ASGI servers |
67+
| **[`HttpResolverLocal`](#http-resolver-local)** | ASGI-compatible resolver |
6868
<!-- markdownlint-enable MD051 -->
6969

7070
#### Response auto-serialization

docs/includes/_http_resolver_local.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
<!-- markdownlint-disable MD041 MD043 -->
2-
#### Http Resolver (Local Development)
2+
#### Http Resolver (ASGI)
33

4-
???+ warning "Local Development Only"
5-
`HttpResolverLocal` is intended for local development and testing only.
6-
The API may change in future releases. **Do not use in production environments.**
7-
8-
When developing locally, you can use `HttpResolverLocal` to run your API with any ASGI server like [uvicorn](https://www.uvicorn.org/){target="_blank"}. It implements the [ASGI specification](https://asgi.readthedocs.io/){target="_blank"}, is lightweight with no external dependencies, and the same code works on any compute platform, including Lambda.
4+
`HttpResolver` is an ASGI-compatible resolver that lets you run your Powertools application with any ASGI server like [uvicorn](https://www.uvicorn.org/){target="_blank"}. It implements the [ASGI specification](https://asgi.readthedocs.io/){target="_blank"}, is lightweight with no external dependencies, and works seamlessly with Lambda or any environment that speaks HTTP.
95

106
If your Lambda is behind [Lambda Web Adapter](https://github.com/awslabs/aws-lambda-web-adapter){target="_blank"} or any other HTTP proxy that speaks the HTTP protocol, it works seamlessly.
117

examples/event_handler_rest/src/http_resolver_basic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
from aws_lambda_powertools.event_handler import HttpResolverLocal
1+
from aws_lambda_powertools.event_handler import HttpResolver
22

3-
app = HttpResolverLocal()
3+
app = HttpResolver()
44

55

66
@app.get("/hello/<name>")

examples/event_handler_rest/src/http_resolver_exception_handling.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
from aws_lambda_powertools.event_handler import HttpResolverLocal, Response
1+
from aws_lambda_powertools.event_handler import HttpResolver, Response
22

3-
app = HttpResolverLocal()
3+
app = HttpResolver()
44

55

66
class NotFoundError(Exception):

examples/event_handler_rest/src/http_resolver_validation_swagger.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
from pydantic import BaseModel
22

3-
from aws_lambda_powertools.event_handler import HttpResolverLocal
3+
from aws_lambda_powertools.event_handler import HttpResolver
44

55

66
class User(BaseModel):
77
name: str
88
age: int
99

1010

11-
app = HttpResolverLocal(enable_validation=True)
11+
app = HttpResolver(enable_validation=True)
1212

1313
app.enable_swagger(
1414
title="My API",

tests/functional/event_handler/_pydantic/test_http_resolver_pydantic.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313
from aws_lambda_powertools.event_handler.http_resolver import MockLambdaContext
1414
from aws_lambda_powertools.event_handler.openapi.params import Query
1515

16-
# Suppress warning for all tests
17-
pytestmark = pytest.mark.filterwarnings("ignore:HttpResolverLocal is intended for local development")
18-
19-
2016
# =============================================================================
2117
# ASGI Test Helpers
2218
# =============================================================================

tests/functional/event_handler/required_dependencies/test_http_resolver.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Tests for HttpResolverLocal - ASGI-compatible HTTP resolver for local development."""
1+
"""Tests for HttpResolverLocal - ASGI-compatible HTTP resolver."""
22

33
from __future__ import annotations
44

@@ -11,10 +11,6 @@
1111
from aws_lambda_powertools.event_handler import HttpResolverLocal, Response
1212
from aws_lambda_powertools.event_handler.http_resolver import MockLambdaContext
1313

14-
# Suppress warning for all tests
15-
pytestmark = pytest.mark.filterwarnings("ignore:HttpResolverLocal is intended for local development")
16-
17-
1814
# =============================================================================
1915
# ASGI Test Helpers
2016
# =============================================================================

0 commit comments

Comments
 (0)