winglang / wing

A programming language for the cloud ☁️ A unified programming model, combining infrastructure and runtime code into one language ⚡
https://winglang.io
Other
5.07k stars 198 forks source link

Add support for http format and parse functions in preflight #7100

Open boyney123 opened 2 months ago

boyney123 commented 2 months ago

Use Case

HTTP has some useful functions for parsing and formatting, but these functions are only supported inflight.

Unless I don't fully understand...I can't see why these can't be supported for preflight?

bring http;
bring cloud;

new cloud.Function(inflight () => {
  let parts = http.parseUrl("postgres://user:pass@host.com:5432/path?k=v#f");

  log(parts.hostname);
  log(parts.host);
  log(parts.hash);
  log(parts.origin);
  log(parts.username);
  log(parts.password);
  log(parts.pathname);
  log(parts.port);
  log(parts.protocol);
  log(parts.search);

});

Proposed Solution

Expose format and parse HTTP functions to preflight, same API.

Implementation Notes

No response

Component

No response

Community Notes