Skip to content

Commit 2e6440d

Browse files
committed
feat(examples): update examples re: spin:up/http-trigger@4.0.0
Signed-off-by: Vaughn Dice <vdice@akamai.com>
1 parent 82f75ef commit 2e6440d

34 files changed

Lines changed: 160 additions & 335 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ component = "hello"
4848
[component.hello]
4949
source = "app.wasm"
5050
[component.hello.build]
51-
command = "componentize-py -w spin-http componentize app -o app.wasm"
51+
command = "componentize-py -w spin:up/http-trigger@4.0.0 componentize app -o app.wasm"
5252
EOF
5353
```
5454

@@ -57,8 +57,8 @@ cat >app.py <<EOF
5757
from spin_sdk import http
5858
from spin_sdk.http import Request, Response
5959
60-
class IncomingHandler(http.IncomingHandler):
61-
def handle_request(self, request: Request) -> Response:
60+
class WasiHttpHandler030Rc20260315(http.Handler):
61+
async def handle_request(self, request: Request) -> Response:
6262
return Response(
6363
200,
6464
{"content-type": "text/plain"},

examples/external-lib-example/app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ def handle_queryparams(uri: ParseResult, request: Request) -> Response:
3939
return Response(200, {"content-type": "text/plain"}, bytes(foo, "utf-8"))
4040

4141

42-
class WasiHttpIncomingHandler020(http.IncomingHandler):
43-
def handle_request(self, request: Request) -> Response:
42+
class WasiHttpHandler030Rc20260315(http.Handler):
43+
async def handle_request(self, request: Request) -> Response:
4444
# I need to parse the URI because the Request object in Spin
4545
# is in the form /path/to/thing?param1=val1&p2=v2#anchor
4646
# and we need just /path/to/thing

examples/external-lib-example/spin.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ component = "test"
1414
source = "app.wasm"
1515
allowed_outbound_hosts = []
1616
[component.test.build]
17-
command = "componentize-py -w fermyon:spin/http-trigger@3.0.0 componentize app -o app.wasm"
17+
command = "componentize-py -w spin:up/http-trigger@4.0.0 componentize app -o app.wasm"

examples/hello/app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from spin_sdk import http
22
from spin_sdk.http import Request, Response
33

4-
class WasiHttpIncomingHandler020(http.IncomingHandler):
5-
def handle_request(self, request: Request) -> Response:
4+
class WasiHttpHandler030Rc20260315(http.Handler):
5+
async def handle_request(self, request: Request) -> Response:
66
return Response(
77
200,
88
{"content-type": "text/plain"},

examples/hello/spin.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ component = "test"
1414
source = "app.wasm"
1515
allowed_outbound_hosts = []
1616
[component.test.build]
17-
command = "componentize-py -w fermyon:spin/http-trigger@3.0.0 componentize app -o app.wasm"
17+
command = "componentize-py -w spin:up/http-trigger@4.0.0 componentize app -o app.wasm"

examples/matrix-math/app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
from spin_sdk import http
44
from spin_sdk.http import Request, Response
55

6-
class WasiHttpIncomingHandler020(http.IncomingHandler):
7-
def handle_request(self, request: Request) -> Response:
6+
class WasiHttpHandler030Rc20260315(http.Handler):
7+
async def handle_request(self, request: Request) -> Response:
88
if request.method == "POST" \
99
and request.uri == "/multiply" \
1010
and request.headers["content-type"] == "application/json" \

examples/matrix-math/spin.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ component = "test"
1414
source = "app.wasm"
1515
allowed_outbound_hosts = []
1616
[component.test.build]
17-
command = "componentize-py -w fermyon:spin/http-trigger@3.0.0 componentize app -o app.wasm"
17+
command = "componentize-py -w spin:up/http-trigger@4.0.0 componentize app -o app.wasm"

examples/outgoing-request/app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from spin_sdk import http
22
from spin_sdk.http import Request, Response, send
33

4-
class WasiHttpIncomingHandler020(http.IncomingHandler):
5-
def handle_request(self, request: Request) -> Response:
4+
class WasiHttpHandler030Rc20260315(http.Handler):
5+
async def handle_request(self, request: Request) -> Response:
66
try:
77
url = request.headers["url"]
88
except KeyError:

examples/outgoing-request/spin.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ component = "test"
1414
source = "app.wasm"
1515
allowed_outbound_hosts = ["http://*:*", "https://*:*"]
1616
[component.test.build]
17-
command = "componentize-py -w fermyon:spin/http-trigger@3.0.0 componentize app -o app.wasm"
17+
command = "componentize-py -w spin:up/http-trigger@4.0.0 componentize app -o app.wasm"

examples/redis-trigger/app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from spin_sdk.wit import exports
22

3-
class FermyonSpinInboundRedis(exports.FermyonSpinInboundRedis):
4-
def handle_message(self, message: bytes):
3+
class SpinRedisInboundRedis300(exports.SpinRedisInboundRedis300):
4+
async def handle_message(self, message: bytes):
55
print(message)

0 commit comments

Comments
 (0)