tiny.http.ClientResponse
Defined in tiny.http.
API (7)
Actions
Public operations.
headerparse: Parses one complete response out ofdataand copies its bytes intoscratch.parseForMethod
Fields and members
Public fields and members.
Source
Source: lib/http/src/client/response.zig:93
zig
pub const ClientResponse = struct { status: u16, headers: []const Header, body: []const u8, connection_reusable: bool, pub fn header(self: ClientResponse, name: []const u8) ?[]const u8 { for (self.headers) |item| { if (std.ascii.eqlIgnoreCase(item.name, name)) return item.value; } return null; } /// Parses one complete response out of `data` and copies its bytes into /// `scratch` . The returned headers and body are slices of `scratch` , so they /// stay valid until that scratch is parsed into again. A chunked body is /// decoded in place inside the body region, over the chunk framing already /// written there. Capacity is checked before any byte is copied, so a scratch /// too small for the headers, the head, or the body returns an error and /// publishes nothing. A caller can enlarge the scratch and call again. pub fn parse(scratch: Scratch, data: []const u8) Error!ClientResponse { return parseWithMethod(scratch, data, null); } pub fn parseForMethod(scratch: Scratch, data: []const u8, method: []const u8) Error!ClientResponse { return parseWithMethod(scratch, data, method); }};Source: lib/http/src/root.zig:94
zig
pub const ClientResponse = client.ClientResponse;Complete caller list for ClientResponse.parse
14 direct callers.
lib.http.src.client.response.test_Client_response_capacity_failures_preserve_result_storage[function] — test source atlib/http/src/client/response.zig:675in nearest public ownerlib.http.src.client.responselib.http.src.client.response.test_Client_response_parsing_accepts_exact_capacities[function] — test source atlib/http/src/client/response.zig:719in nearest public ownerlib.http.src.client.responselib.http.src.client.response.test_Client_response_parsing_preserves_HTTP_body_semantics[function] — test source atlib/http/src/client/response.zig:747in nearest public ownerlib.http.src.client.responselib.http.src.client.response.test_Client_response_semantic_failures_preserve_result_storage[function] — test source atlib/http/src/client/response.zig:1105in nearest public ownerlib.http.src.client.responselib.http.src.client.runtime.test_ClientResponse.parse:_401_with_JSON_body[function] — test source atlib/http/src/client/runtime.zig:1868in nearest public ownerlib.http.src.client.runtimelib.http.src.client.runtime.test_ClientResponse.parse:_chunked_trailers[function] — test source atlib/http/src/client/runtime.zig:1923in nearest public ownerlib.http.src.client.runtimelib.http.src.client.runtime.test_ClientResponse.parse:_chunked_transfer_encoding[function] — test source atlib/http/src/client/runtime.zig:1914in nearest public ownerlib.http.src.client.runtimelib.http.src.client.runtime.test_ClientResponse.parse:_empty_chunked_body[function] — test source atlib/http/src/client/runtime.zig:1941in nearest public ownerlib.http.src.client.runtimelib.http.src.client.runtime.test_ClientResponse.parse:_no-body_statuses_preserve_headers_and_omit_body[function] — test source atlib/http/src/client/runtime.zig:1886in nearest public ownerlib.http.src.client.runtimelib.http.src.client.runtime.test_ClientResponse.parse:_rejects_truncated_content-length_body[function] — test source atlib/http/src/client/runtime.zig:1877in nearest public ownerlib.http.src.client.runtimelib.http.src.client.runtime.test_ClientResponse.parse:_simple_200[function] — test source atlib/http/src/client/runtime.zig:1825in nearest public ownerlib.http.src.client.runtimelib.http.src.client.runtime.test_ClientResponse.parse:_transfer_encoding_token_is_case-insensitive[function] — test source atlib/http/src/client/runtime.zig:1932in nearest public ownerlib.http.src.client.runtimelib.http.src.client.runtime.test_ClientResponse.parse:_truncated_chunked_body_errors[function] — test source atlib/http/src/client/runtime.zig:1905in nearest public ownerlib.http.src.client.runtimelib.http.src.client.runtime.test_ClientResponse_persistence_follows_version_framing_and_Connection[function] — test source atlib/http/src/client/runtime.zig:1835in nearest public ownerlib.http.src.client.runtime
Audit
| Definitions | 4 |
|---|---|
| Public names | 4 |
| Members | 4 |
| Version | 26.7.0 |
| Revision | daab053ee433 |