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

GET /cloudevents

GET /cloudevents

Returns CloudEvents 1.0 envelopes with spec violations. Default claims specversion 0.3 instead of 1.0. Use ?mode= to isolate other violations: `type` as an integer, a datacontenttype mismatch, or both `data` and `data_base64` present.

mode specversion-lie (default; `specversion` is "0.3" instead of "1.0"; consumers that validate version before dispatching reject the envelope or apply 0.3 parsing rules), type-as-number (`type` is integer 42; CloudEvents §3.1 requires a non-empty string; consumers that substring-match on type throw a type error), datacontenttype-mismatch (`datacontenttype` says application/json but `data` is a bare string; consumers call JSON.parse on non-JSON and throw), data-base64-confusion (both `data` and `data_base64` present; CloudEvents §3.1 says mutually exclusive; consumers disagree on which field is authoritative).

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

build a request:

expect: A CloudEvents 1.0 envelope with one spec violation, served as application/cloudevents+json. The `note` field in the body explains what is wrong.

bash
curl -si 'https://chaos.catastrophic.io/cloudevents?mode=specversion-lie' | grep -E '^(HTTP|content-type|x-chaos)'
import urllib.request, json
resp = urllib.request.urlopen("https://chaos.catastrophic.io/cloudevents?mode=specversion-lie")
print("Content-Type:", resp.headers.get("Content-Type"))
print("X-Chaos-Cloudevents-Mode:", resp.headers.get("X-Chaos-Cloudevents-Mode"))
body = json.loads(resp.read())
print("specversion:", body.get("specversion"))
print("type type:", type(body.get("type")).__name__)
print("data present:", "data" in body)
print("data_base64 present:", "data_base64" in body)
print("note:", body.get("note"))
const res = await fetch("https://chaos.catastrophic.io/cloudevents?mode=specversion-lie");
const body = await res.json();
console.log("Content-Type:", res.headers.get("content-type"));
console.log("X-Chaos-Cloudevents-Mode:", res.headers.get("x-chaos-cloudevents-mode"));
console.log("specversion:", body.specversion);
console.log("type value:", body.type, "/ typeof:", typeof body.type);
console.log("data present:", "data" in body);
console.log("data_base64 present:", "data_base64" 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/cloudevents?mode=specversion-lie")
    defer resp.Body.Close()
    raw, _ := io.ReadAll(resp.Body)
    var body map[string]any
    json.Unmarshal(raw, &body)
    fmt.Println("Content-Type:", resp.Header.Get("Content-Type"))
    fmt.Println("X-Chaos-Cloudevents-Mode:", resp.Header.Get("X-Chaos-Cloudevents-Mode"))
    fmt.Println("specversion:", body["specversion"])
    fmt.Printf("type value: %v (Go type: %T)\n", body["type"], body["type"])
    _, hasData := body["data"]
    _, hasDataB64 := body["data_base64"]
    fmt.Println("data present:", hasData, "/ data_base64 present:", hasDataB64)
}
// Cargo.toml: reqwest = { version = "0.12", features = ["blocking", "json"] }
fn main() -> Result<(), Box> {
    let resp = reqwest::blocking::get("https://chaos.catastrophic.io/cloudevents?mode=specversion-lie")?;
    println!("Content-Type: {:?}", resp.headers().get("content-type"));
    println!("X-Chaos-Cloudevents-Mode: {:?}", resp.headers().get("x-chaos-cloudevents-mode"));
    let body: serde_json::Value = resp.json()?;
    println!("specversion: {:?}", body.get("specversion"));
    println!("type: {:?}", body.get("type"));
    println!("data present: {} / data_base64 present: {}",
        body.get("data").is_some(), body.get("data_base64").is_some());
    Ok(())
}
import java.net.URI;
import java.net.http.*;

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