Import std.net.http.client
HttpResponse
class
Public Class HttpResponse
What a server answered: its status, its headers, its body's bytes, the URL it came from, after the redirects followed, and the HTTP it came over, "HTTP/1.1" or "HTTP/2".
Examples
Local response = HttpResponse(404, Headers(), "gone".Bytes, "https://example.com/old")
Expect(!response.IsSuccess && response.Text == "gone")
Expect(ExpectThrows<NetError>(response.EnsureSuccess())?.Kind == NetErrorKind.HTTP_STATUS)std/net/http/client.fb, line 139
-
Its status, like 200 or 404.
-
Its headers.
-
Its body's bytes.
-
The URL it came from, after the redirects followed.
-
The HTTP it came over: "HTTP/1.1" or "HTTP/2".
-
Public New(status: Int, headers: Headers, bytes: UInt8[], url: String, version: String = "HTTP/1.1")constructor #A response of
status, withheadersandbytes, fromurl, overversion. -
The body as text, its UTF-8, with U+FFFD for each byte that doesn't start well-formed UTF-8.
-
Whether its Status says the request worked: from 200 to 299.
-
Throws a NetError of HTTP_STATUS unless IsSuccess.
Report an issue with this page or with FutureBlitz on GitHub.