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

feat: add new Go bindings to perform HTTP requests #173

Merged
merged 2 commits into from
Jul 11, 2023

Conversation

Angelmmiguel
Copy link
Contributor

Define the new HTTP bindings for the Go kit and expose a new SendHttpRequest method. It includes new WIT files that are required due to a mismatch between the wit-bindgen version used by the host (v0.2) and the Go kit (v0.6). I also had to adapt the generated code to work between these versions. You have all the information in the kits/go/worker/README.md file.

Changes

  • Define new WIT files that outputs the same bindings as wit/core but are compatible with wit-bindgen v0.6.
  • Generate the bindings following the approach described on the kits/go/worker/README.md file.
  • Add a new SendHttpRequest method in the Go kit.
  • Ensure this method interacts with the http.Request and http.Response structs instead of the internal ones.
  • Add new examples and update the documentation so current ones work properly Wasm Workers Server v1.3.0

It refs #165

@Angelmmiguel Angelmmiguel added the 🚀 enhancement New feature or request label Jul 10, 2023
@Angelmmiguel Angelmmiguel added this to the v1.4.0 milestone Jul 10, 2023
@Angelmmiguel Angelmmiguel requested a review from a team July 10, 2023 12:15
@Angelmmiguel Angelmmiguel self-assigned this Jul 10, 2023
Copy link
Contributor

@ereslibre ereslibre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, great work @Angelmmiguel. Minor comments and questions.

kits/go/worker/README.md Outdated Show resolved Hide resolved
kits/go/worker/README.md Outdated Show resolved Hide resolved
kits/go/worker/README.md Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file exists due to the issues you mentioned with WIT format and incompatibilities at the WIT format between those versions, right? I guess, the idea is to have a single WIT directory with the definitions that all kits consume at some point, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly. WIT has evolved a lot and there're some breaking changes while the spec stabilizes. The end goal is to have a single WIT definition once we can recreate all kits based on it.

Currently, this is the situation:

  • core: oldest WIT version
  • go-ephemeral: WIT version before packages

Copy link
Contributor

@ereslibre ereslibre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👏

@Angelmmiguel Angelmmiguel merged commit 6c9655e into main Jul 11, 2023
@Angelmmiguel Angelmmiguel deleted the 165-add-http-requests-to-go branch July 14, 2023 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants