SERVER / HTTP

Make a controlled outbound request

http is a server-only declaration for outbound Dowe runtime requests. It gives the response a named binding while keeping URLs, credentials, and response handling inside the server boundary.

1 / MENTAL MODEL

Declare the response binding first

The name after http is the response variable for later statements. Use one lowercase method value and keep base, path, headers, timeout, and response mode explicit.

dowe
handler fetchStatus
  http upstream method:"get" base:env.MEDIA_BASE_URL path:"/api/status" mode:"bytes" headers:[{ name:"Accept" value:"application/json" }]
  return json:{ ok:upstream.ok status:upstream.status }
Part
Contract

No data

There are no records to display

2 / PROXY AND SAFETY

Keep authority explicit

Declare base and bearer names in .env.example, supply values through .env or the process environment, and reference them only from server source. Headers are validated, Authorization belongs in bearer, and redirect plus timeout policy remain visible in source.

dowe
handler chatCompletions
  const body value:req.json
  http upstream method:"post" base:env.OPENROUTER_BASE_URL path:"/api/v1/chat/completions" bearer:env.OPENROUTER_API_KEY json:body mode:"proxy" timeoutMs:10000
  return proxy:upstream
Concern
Guidance

No data

There are no records to display