API Reference › Http › Http.parse
method

Http.parse

Http.parse(bytes, len) -> int

Parses a raw HTTP/1.1 response (status line + headers + body) into a ready handle — useful for caches, custom transports, and tests. Transport-independent and pure.

Example

program Demo {
  entry {
    let raw = "HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\n\r\nhi"
    let h = Http.parse(raw, Text.length(raw))
    print(Http.status(h))
  }
}
← All symbols