GET Requests

JumpKick.HttpLib — GET Requests

1. Basic Syntax

Http.Get("target‑url")
.OnSuccess(result => {
    // Success callback: receives raw HTML source text
})
.OnFail(webexception => {
    // Failure callback: catches network‑related exceptions
})
.Go(); // Start asynchronous network requestCode language: JavaScript (javascript)
  • OnSuccess: Triggered when connection is established and server responds normally
  • OnFail: Fires on invalid domain, connection failure, 404, network drop and other errors
  • .Go(): Executes the request, runs asynchronously without blocking the main thread

1: Minimal Working Request (no exception handling)

Without OnFail, any network error will crash your program with a popup error dialog

using System;
using JumpKick.HttpLib;

class Program
{
    static void Main(string[] args)
    {
        Http.Get("https://httpbin.org/html")
        .OnSuccess(result =>
        {
            Console.WriteLine(result);
        })
        .Go();

        Console.ReadKey();
    }
}Code language: JavaScript (javascript)

2: Success and Exception Handling

using System;
using JumpKick.HttpLib;

class Program
{
    static void Main(string[] args)
    {
        Http.Get("https://httpbin.org/html")
        .OnSuccess(result =>
        {
            Console.WriteLine("==== Request Succeeded ====");
            Console.WriteLine(result);
        })
        .OnFail(webexception =>
        {
            Console.WriteLine("==== Request Failed ====");
            Console.WriteLine(webexception.Message);
        })
        .Go();

        Console.ReadKey();
    }
}Code language: JavaScript (javascript)

3: Intentional Error Test

Deliberately malformed domainhttps://httpbin.org/html1 (extra trailing letter l), used to verify OnFail works correctly

using System;
using JumpKick.HttpLib;

class Program
{
    static void Main(string[] args)
    {
        // Bad URL: extra character added to force DNS resolution failure
        Http.Get("https://httpbin.org/htmll")
        .OnSuccess(result =>
        {
            Console.WriteLine("==== Request Succeeded ====");
            Console.WriteLine(result);
        })
        .OnFail(webexception =>
        {
            Console.WriteLine("==== Request Exception (Caught) ====");
            Console.WriteLine("Error message: " + webexception.Message);
        })
        .Go();

        Console.ReadKey();
    }
}Code language: JavaScript (javascript)

Example

// Non‑existent domain, reliably triggers network exception
Http.Get("https://no-website-test-9999.test")
.OnSuccess(result =>
{
    Console.WriteLine("==== Request Succeeded ====");
    Console.WriteLine(result);
})
.OnFail(webexception =>
{
    Console.WriteLine("==== Request Exception (Caught) ====");
    Console.WriteLine("Error message: " + webexception.Message);
})
.Go();
Console.ReadKey();Code language: JavaScript (javascript)

GET Requests

Previous:

Leave a Reply

Your email address will not be published. Required fields are marked *