HttpReq models the request side of an XMLHttpRequest instance.
See pod doc for details.
Bool async := true
If true then perform this request asynchronously. Defaults to
send("GET", "", c).
The request headers to send.
new make(|This|? f := null)
Create a new HttpReq instance.
Optional callback to track progress of request transfers, where
loadedis the number of bytes that have been transferred, and
totalis the total number of bytes to be transferred.
GETrequests, the progress will track the response being downloaded to the browser. For
POSTrequests, the progress will track the content being uploaded to the server.
Note this callback is only invoked when
trueon the underlying progress events.
send("POST", content, c).
formmap as a HTML form submission. Formats the map into a valid url-encoded content string, and sets
Send a request with the given content using the given HTTP method (case does not matter). After receiving the response, call the given closure with the resulting HttpRes object.
Uri uri := `#`
The Uri to send the request.
Bool withCredentials := false
Indicates whether or not cross-site
Access-Controlrequests should be made using credentials such as cookies, authorization headers or TLS client certificates. Setting
withCredentialshas no effect on same-site requests. The default is
Requests from a different domain cannot set cookie values for their own domain unless
withCredentialsis set to
truebefore making the request. The third-party cookies obtained by setting
truewill still honor same-origin policy and hence can not be accessed by the requesting script through
Doc.cookiesor from response headers.