JsonRequester¶
Issues an HTTP request that expects a JSON response. Supports GET (200), POST (201), and PATCH (200) methods. GET requests follow 301/307 redirects automatically. On success, the response body is parsed as JSON and delivered to the receiver; on failure, the receiver gets the status code, raw response body, and an error message.
Implements¶
Constructors¶
get¶
Issues an HTTP GET request expecting a 200 response with a JSON body.
new tag get(
creds: Credentials val,
url: String val,
receiver: JsonRequesterResultReceiver tag)
: JsonRequester tag^
Parameters¶
- creds: Credentials val
- url: String val
- receiver: JsonRequesterResultReceiver tag
Returns¶
- JsonRequester tag^
post¶
Issues an HTTP POST request expecting a 201 response with a JSON body.
new tag post(
creds: Credentials val,
url: String val,
body: String val,
receiver: JsonRequesterResultReceiver tag)
: JsonRequester tag^
Parameters¶
- creds: Credentials val
- url: String val
- body: String val
- receiver: JsonRequesterResultReceiver tag
Returns¶
- JsonRequester tag^
patch¶
Issues an HTTP PATCH request expecting a 200 response with a JSON body.
new tag patch(
creds: Credentials val,
url: String val,
body: String val,
receiver: JsonRequesterResultReceiver tag)
: JsonRequester tag^
Parameters¶
- creds: Credentials val
- url: String val
- body: String val
- receiver: JsonRequesterResultReceiver tag
Returns¶
- JsonRequester tag^
Public Behaviours¶
dispose¶
Public Functions¶
on_connected¶
Returns¶
- None val
on_response¶
Parameters¶
- response: Response val
Returns¶
- None val
on_body_chunk¶
Parameters¶
Returns¶
- None val
on_response_complete¶
Returns¶
- None val
on_connection_failure¶
fun ref on_connection_failure(
reason: (ConnectionFailedDNS val | ConnectionFailedTCP val | ConnectionFailedSSL val |
ConnectionFailedTimeout val))
: None val
Parameters¶
- reason: (ConnectionFailedDNS val | ConnectionFailedTCP val | ConnectionFailedSSL val | ConnectionFailedTimeout val)
Returns¶
- None val
on_parse_error¶
fun ref on_parse_error(
err: (TooLarge val | InvalidStatusLine val | InvalidVersion val |
MalformedHeaders val | InvalidContentLength val | InvalidChunk val |
BodyTooLarge val))
: None val
Parameters¶
- err: (TooLarge val | InvalidStatusLine val | InvalidVersion val | MalformedHeaders val | InvalidContentLength val | InvalidChunk val | BodyTooLarge val)
Returns¶
- None val
on_closed¶
Returns¶
- None val
on_throttled¶
Returns¶
- None val
on_unthrottled¶
Returns¶
- None val