online / endpoints 59 / categories 14 / rate 60/min/ip /

GET /jsonrpc

GET /jsonrpc

Returns JSON-RPC 2.0 responses with spec-level violations. Default omits the required `jsonrpc` version field. Use ?mode= to isolate other violations: mismatched response id, both result and error present, or a reserved-but-unassigned error code.

mode version-missing (default; `jsonrpc` field absent; signals a 1.x response with a different envelope; strict clients reject), id-mismatch (response `id` is 99 but request id was 1; clients correlating by id fail to match), result-and-error (both `result` and `error` present; JSON-RPC 2.0 §5 says mutually exclusive; clients checking only one field miss the other), error-code-invalid (`error.code` is -32001, inside the reserved range but not a standard code; clients mapping codes to exception types fall through to unknown-error).

control Compare against the well-formed counterpart: not.catastrophic.io/jsonrpc side-by-side

build a request:

expect: A JSON-RPC 2.0 response envelope with one spec violation. The `note` field in the body explains what is wrong.

bash
curl -si 'https://chaos.catastrophic.io/jsonrpc?mode=version-missing' | grep -E '^(HTTP|content-type|x-chaos)'
import urllib.request, json
resp = urllib.request.urlopen("https://chaos.catastrophic.io/jsonrpc?mode=version-missing")
print("X-Chaos-Jsonrpc-Mode:", resp.headers.get("X-Chaos-Jsonrpc-Mode"))
body = json.loads(resp.read())
print("jsonrpc present:", "jsonrpc" in body)
print("result present:", "result" in body)
print("error present:", "error" in body)
print("note:", body.get("note"))
const res = await fetch("https://chaos.catastrophic.io/jsonrpc?mode=version-missing");
const body = await res.json();
console.log("X-Chaos-Jsonrpc-Mode:", res.headers.get("x-chaos-jsonrpc-mode"));
console.log("jsonrpc present:", "jsonrpc" in body);
console.log("result present:", "result" in body);
console.log("error present:", "error" in body);
console.log("note:", body.note);
package main

import (
    "encoding/json"
    "fmt"
    "io"
    "net/http"
)

func main() {
    resp, _ := http.Get("https://chaos.catastrophic.io/jsonrpc?mode=version-missing")
    defer resp.Body.Close()
    raw, _ := io.ReadAll(resp.Body)
    var body map[string]any
    json.Unmarshal(raw, &body)
    fmt.Println("X-Chaos-Jsonrpc-Mode:", resp.Header.Get("X-Chaos-Jsonrpc-Mode"))
    _, hasVersion := body["jsonrpc"]
    _, hasResult := body["result"]
    _, hasError := body["error"]
    fmt.Println("jsonrpc present:", hasVersion)
    fmt.Println("result present:", hasResult)
    fmt.Println("error present:", hasError)
}
// Cargo.toml: reqwest = { version = "0.12", features = ["blocking", "json"] }
fn main() -> Result<(), Box> {
    let resp = reqwest::blocking::get("https://chaos.catastrophic.io/jsonrpc?mode=version-missing")?;
    println!("X-Chaos-Jsonrpc-Mode: {:?}", resp.headers().get("x-chaos-jsonrpc-mode"));
    let body: serde_json::Value = resp.json()?;
    println!("jsonrpc present: {}", body.get("jsonrpc").is_some());
    println!("result present: {}", body.get("result").is_some());
    println!("error present: {}", body.get("error").is_some());
    Ok(())
}
import java.net.URI;
import java.net.http.*;

public class JsonRpcChaos {
    public static void main(String[] args) throws Exception {
        var client = HttpClient.newHttpClient();
        var req = HttpRequest.newBuilder(URI.create("https://chaos.catastrophic.io/jsonrpc?mode=version-missing")).build();
        var resp = client.send(req, HttpResponse.BodyHandlers.ofString());
        System.out.println("X-Chaos-Jsonrpc-Mode: " +
            resp.headers().firstValue("X-Chaos-Jsonrpc-Mode").orElse(""));
        System.out.println("Body: " + resp.body());
    }
}
using var client = new HttpClient();
var resp = await client.GetAsync("https://chaos.catastrophic.io/jsonrpc?mode=version-missing");
Console.WriteLine($"X-Chaos-Jsonrpc-Mode: " +
    $"{resp.Headers.GetValues("X-Chaos-Jsonrpc-Mode").FirstOrDefault()}");
var body = await resp.Content.ReadAsStringAsync();
Console.WriteLine($"Body: {body}");
require "net/http"
require "json"
uri = URI("https://chaos.catastrophic.io/jsonrpc?mode=version-missing")
Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
    res = http.get(uri.request_uri)
    puts "X-Chaos-Jsonrpc-Mode: #{res['X-Chaos-Jsonrpc-Mode']}"
    body = JSON.parse(res.body)
    puts "jsonrpc present: #{body.key?('jsonrpc')}"
    puts "result present: #{body.key?('result')}"
    puts "error present: #{body.key?('error')}"
end
$r = Invoke-RestMethod -Uri 'https://chaos.catastrophic.io/jsonrpc?mode=version-missing' -ResponseHeadersVariable h
"X-Chaos-Jsonrpc-Mode: $($h['X-Chaos-Jsonrpc-Mode'])"
"jsonrpc present: $($r.PSObject.Properties['jsonrpc'] -ne $null)"
"result present: $($r.PSObject.Properties['result'] -ne $null)"
"error present: $($r.PSObject.Properties['error'] -ne $null)"