这是indexloc提供的服务,不要输入任何密码
Skip to content

Send HTTP requests from inside the workers (fetch support) #165

@Angelmmiguel

Description

@Angelmmiguel

Is your feature request related to a problem? Please describe.

When I write a worker, I can only rely on the data that comes from a local file (mounted folders), environments variables or hardcoded in code. This reduces the kind of projects I can develop.

Describe the solution you'd like

I would like to call an external HTTP API from inside a worker. Every language has its own way to do it, so I want to use those common patterns. For example, the fetch method is the most common API for calling an HTTP endpoint in JavaScript.

To follow the capability-based approach, I want to configure the HTTP endpoints a worker can call. I want to avoid a worker calling random HTTP endpoints. For this, I would add a new section in the TOML file called "features". This object includes one configuration per feature like:

[features]
[features.fetch]
allowed_domains = ["https://example.com"]
force_ssl = true

Host implementation

Language implementation

I will start with JavaScript, but I will extend the support to other languages soon:

Future implementations

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions