Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Struct

RequestOptions

Public Struct
std.http.Client.RequestOptions
pub const RequestOptions = struct

Fields

version: http.Version = .@"HTTP/1.1"
handle_continue: bool = true

Automatically ignore 100 Continue responses. This assumes you don't care, and will have sent the body before you wait for the response.

If this is not the case AND you know the server will send a 100 Continue, set this to false and wait for a response before sending the body. If you wait AND the server does not send a 100 Continue before you finish the request, then the request will deadlock.

keep_alive: bool = true

If false, close the connection after the one request. If true, participate in the client connection pool.

redirect_behavior: Request.RedirectBehavior = @fromBackingInt(@intCast(3))

This field specifies whether to automatically follow redirects, and if so, how many redirects to follow before returning an error.

This will only follow redirects for repeatable requests (ie. with no payload or the server has acknowledged the payload).

connection: ?*Connection = null

Must be an already acquired connection.

headers: Request.Headers = .{}

Standard headers that have default, but overridable, behavior.

extra_headers: []const http.Header = &.{}

These headers are kept including when following a redirect to a different domain. Externally-owned; must outlive the Request.

privileged_headers: []const http.Header = &.{}

These headers are stripped when following a redirect to a different domain. Externally-owned; must outlive the Request.

File

http/Client.zig:1636
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
pub const RequestOptions = struct {
    version: http.Version = .@"HTTP/1.1",

    /// Automatically ignore 100 Continue responses. This assumes you don't
    /// care, and will have sent the body before you wait for the response.
    ///
    /// If this is not the case AND you know the server will send a 100
    /// Continue, set this to false and wait for a response before sending the
    /// body. If you wait AND the server does not send a 100 Continue before
    /// you finish the request, then the request *will* deadlock.
    handle_continue: bool = true,

    /// If false, close the connection after the one request. If true,
    /// participate in the client connection pool.
    keep_alive: bool = true,

    /// This field specifies whether to automatically follow redirects, and if
    /// so, how many redirects to follow before returning an error.
    ///
    /// This will only follow redirects for repeatable requests (ie. with no
    /// payload or the server has acknowledged the payload).
    redirect_behavior: Request.RedirectBehavior = @fromBackingInt(@intCast(3)),

    /// Must be an already acquired connection.
    connection: ?*Connection = null,

    /// Standard headers that have default, but overridable, behavior.
    headers: Request.Headers = .{},
    /// These headers are kept including when following a redirect to a
    /// different domain.
    /// Externally-owned; must outlive the Request.
    extra_headers: []const http.Header = &.{},
    /// These headers are stripped when following a redirect to a different
    /// domain.
    /// Externally-owned; must outlive the Request.
    privileged_headers: []const http.Header = &.{},
}