we (web engine): Experimental web browser project to understand the limits of Claude

Fetch API backed by net crate #111

open opened by pierrelf.com

Implement the Fetch API, returning Promises and backed by the existing net crate (HTTP/1.1 + TLS).

Scope#

fetch() Global Function#

  • fetch(url) — initiate HTTP GET, return Promise
  • fetch(url, options) — support options:
    • method — HTTP method (GET, POST, PUT, DELETE, etc.)
    • headers — object or Headers instance
    • body — string body for POST/PUT
  • Returns a Promise that resolves to a Response object
  • Promise rejects on network errors (DNS failure, connection refused, TLS errors)

Response Object#

  • response.ok — boolean, true if status 200-299
  • response.status — HTTP status code (number)
  • response.statusText — status text string
  • response.headers — Headers object
  • response.url — final URL after redirects
  • response.text() — return Promise of response body
  • response.json() — return Promise
sign up or login to add to the discussion
Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:meotu43t6usg4qdwzenk4s2t/sh.tangled.repo.issue/3mhyfoli6gc2g