GET /image
/imageReturns a real 1×1 PNG whose magic bytes, Content-Type, Content-Length, and IHDR dimensions all agree. Counterpart to the chaos /image endpoint, which deliberately ships images whose metadata contradicts the bytes.
expect: 200 OK with Content-Type: image/png. Magic bytes, Content-Length, and IHDR dimensions all agree. Decoders accept the image cleanly.
# Save the body and compare Content-Type to the actual magic bytes.
curl -sD - 'https://not.catastrophic.io/image' -o /tmp/chaos.bin | grep -i 'content-type\|x-chaos-image'
file /tmp/chaos.bin
import urllib.request
resp = urllib.request.urlopen("https://not.catastrophic.io/image")
body = resp.read()
print("Content-Type:", resp.headers.get("Content-Type"))
print("X-Chaos-Image-Mode:", resp.headers.get("X-Chaos-Image-Mode"))
print("X-Chaos-Image-Note:", resp.headers.get("X-Chaos-Image-Note"))
print(f"First 16 bytes (magic): {body[:16].hex()}")
# PNG magic: 89504e470d0a1a0a JPEG magic: ffd8ff
// Type-trusting client: trust Content-Type and pass straight to a decoder.
const res = await fetch("https://not.catastrophic.io/image");
const bytes = new Uint8Array(await res.arrayBuffer());
const magic = Array.from(bytes.slice(0, 8))
.map(b => b.toString(16).padStart(2, "0")).join("");
console.log("Content-Type:", res.headers.get("content-type"));
console.log("X-Chaos-Image-Note:", res.headers.get("x-chaos-image-note"));
console.log("First 8 bytes:", magic);
package main
import (
"encoding/hex"
"fmt"
"io"
"net/http"
)
func main() {
resp, _ := http.Get("https://not.catastrophic.io/image")
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println("Content-Type:", resp.Header.Get("Content-Type"))
fmt.Println("X-Chaos-Image-Note:", resp.Header.Get("X-Chaos-Image-Note"))
head := body
if len(head) > 16 { head = head[:16] }
fmt.Println("First bytes:", hex.EncodeToString(head))
}
// Cargo.toml: reqwest = { version = "0.12", features = ["blocking"] }
fn main() -> Result<(), Box> {
let resp = reqwest::blocking::get("https://not.catastrophic.io/image")?;
println!("Content-Type: {:?}", resp.headers().get("content-type"));
println!("X-Chaos-Image-Note: {:?}",
resp.headers().get("x-chaos-image-note"));
let bytes = resp.bytes()?;
let head: Vec = bytes.iter().take(16)
.map(|b| format!("{:02x}", b)).collect();
println!("First bytes: {}", head.join(""));
Ok(())
}
// Java 11+ HttpClient.
import java.net.URI;
import java.net.http.*;
public class ImageChaos {
public static void main(String[] args) throws Exception {
var client = HttpClient.newHttpClient();
var req = HttpRequest.newBuilder(URI.create("https://not.catastrophic.io/image")).build();
var resp = client.send(req, HttpResponse.BodyHandlers.ofByteArray());
System.out.println("Content-Type: " +
resp.headers().firstValue("Content-Type").orElse(""));
System.out.println("X-Chaos-Image-Note: " +
resp.headers().firstValue("X-Chaos-Image-Note").orElse(""));
var sb = new StringBuilder();
for (int i = 0; i < Math.min(16, resp.body().length); i++) {
sb.append(String.format("%02x", resp.body()[i]));
}
System.out.println("First bytes: " + sb);
}
}
using var client = new HttpClient();
var resp = await client.GetAsync("https://not.catastrophic.io/image");
Console.WriteLine($"Content-Type: {resp.Content.Headers.ContentType}");
Console.WriteLine($"X-Chaos-Image-Note: {resp.Headers.GetValues("X-Chaos-Image-Note").FirstOrDefault()}");
var bytes = await resp.Content.ReadAsByteArrayAsync();
Console.WriteLine($"First bytes: {Convert.ToHexString(bytes[..Math.Min(16, bytes.Length)])}");
require "net/http"
uri = URI("https://not.catastrophic.io/image")
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-Image-Note: #{res['X-Chaos-Image-Note']}"
puts "First bytes: #{res.body[0, 16].unpack1('H*')}"
end
# Invoke-WebRequest returns raw bytes in .Content for non-text responses.
$r = Invoke-WebRequest -Uri 'https://not.catastrophic.io/image'
"Content-Type: $($r.Headers['Content-Type'])"
"X-Chaos-Image-Note: $($r.Headers['X-Chaos-Image-Note'])"
$hex = ($r.Content[0..15] | ForEach-Object { '{0:x2}' -f $_ }) -join ''
"First bytes: $hex"
headers
body