diff --git a/examples/service-bindings/Makefile b/examples/service-bindings/Makefile index 320ddc3..11a0197 100644 --- a/examples/service-bindings/Makefile +++ b/examples/service-bindings/Makefile @@ -5,7 +5,8 @@ dev: .PHONY: build build: mkdir -p dist - tinygo build -o ./dist/app.wasm -target wasm ./... + #tinygo build -o ./dist/app.wasm -target wasm ./... + tinygo build -o ./dist/app.wasm -target wasm -no-debug ./... .PHONY: publish publish: diff --git a/examples/service-bindings/main.go b/examples/service-bindings/main.go index 452c715..81e1614 100644 --- a/examples/service-bindings/main.go +++ b/examples/service-bindings/main.go @@ -13,17 +13,11 @@ import ( func main() { handler := http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { ctx := req.Context() + bind := cloudflare.GetBinding(ctx, "hello") + fc := fetch.NewClient(fetch.WithBinding(bind)) - obj := cloudflare.GetBinding(ctx, "hello") - cli := fetch.NewClient(fetch.WithBinding(obj)) - r, err := fetch.NewRequest(ctx, http.MethodGet, req.URL.String(), nil) - if err != nil { - fmt.Println(err) - w.WriteHeader(http.StatusInternalServerError) - return - } - - res, err := cli.Do(r) + hc := fc.HTTPClient() + res, err := hc.Do(req) if err != nil { fmt.Println(err) w.WriteHeader(http.StatusInternalServerError)