RequestBuilder
struct RequestBuilderAccumulates a request; build() produces the Request.
Implements Movable
__init__
def __init__(out self, method: String, url: String) Start a builder for method url.
header
def header(mut self, name: String, value: String) Add a request header (repeatable; appends, does not replace).
query
def query(mut self, name: String, value: String) Add a query parameter; name and value are percent-encoded and joined with &.
body
def body(mut self, var data: List[UInt8], content_type: String = "") Set a raw byte body (optionally with a content type).
text
def text(mut self, data: String, content_type: String = "text/plain") Set a UTF-8 text body (default text/plain).
json
def json(mut self, data: String) Set a JSON string body + Content-Type: application/json.
build
def build(var self) -> Request Materialise the Request (consumes the builder).
Query parameters are appended to the URL (? or & as
appropriate); accumulated headers are copied; Content-Type
is set from the typed-body helpers when present.