Skip to content

JsonRequester

[Source]

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.

actor tag JsonRequester is
  HTTPClientConnectionActor tag

Implements


Constructors

get

[Source]

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

Returns


post

[Source]

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

Returns


patch

[Source]

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

Returns


Public Behaviours

dispose

[Source]

be dispose()

Public Functions

on_connected

[Source]

fun ref on_connected()
: None val

Returns


on_response

[Source]

fun ref on_response(
  response: Response val)
: None val

Parameters

Returns


on_body_chunk

[Source]

fun ref on_body_chunk(
  data: Array[U8 val] val)
: None val

Parameters

Returns


on_response_complete

[Source]

fun ref on_response_complete()
: None val

Returns


on_connection_failure

[Source]

fun ref on_connection_failure(
  reason: (ConnectionFailedDNS val | ConnectionFailedTCP val | ConnectionFailedSSL val | 
    ConnectionFailedTimeout val))
: None val

Parameters

Returns


on_parse_error

[Source]

fun ref on_parse_error(
  err: (TooLarge val | InvalidStatusLine val | InvalidVersion val | 
    MalformedHeaders val | InvalidContentLength val | InvalidChunk val | 
    BodyTooLarge val))
: None val

Parameters

Returns


on_closed

[Source]

fun ref on_closed()
: None val

Returns


on_throttled

[Source]

fun ref on_throttled()
: None val

Returns


on_unthrottled

[Source]

fun ref on_unthrottled()
: None val

Returns