GET /problem-details
/problem-detailsReturns a well-formed RFC 9457 Problem Details object: `type` URI present, `status` as integer 404, `detail` string, `instance` as a URI reference. Counterpart to the chaos /problem-details endpoint.
expect: 404 response with Content-Type: application/problem+json. All required fields present and correctly typed. Build clients against this, then flip hostname to chaos.catastrophic.io to test adversity.
curl -si 'https://not.catastrophic.io/problem-details' | grep -E '^(HTTP|content-type|x-chaos)'
import urllib.request, json
resp = urllib.request.urlopen("https://not.catastrophic.io/problem-details")
print("Content-Type:", resp.headers.get("Content-Type"))
print("X-Chaos-Problem-Details-Mode:", resp.headers.get("X-Chaos-Problem-Details-Mode"))
body = json.loads(resp.read())
print("type present:", "type" in body)
print("status type:", type(body.get("status")).__name__)
print("note:", body.get("note"))
const res = await fetch("https://not.catastrophic.io/problem-details");
const body = await res.json();
console.log("Content-Type:", res.headers.get("content-type"));
console.log("X-Chaos-Problem-Details-Mode:", res.headers.get("x-chaos-problem-details-mode"));
console.log("type present:", "type" in body);
console.log("status type:", typeof body.status);
console.log("note:", body.note);
package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
resp, _ := http.Get("https://not.catastrophic.io/problem-details")
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-Problem-Details-Mode:", resp.Header.Get("X-Chaos-Problem-Details-Mode"))
_, hasType := body["type"]
fmt.Println("type present:", hasType)
fmt.Printf("status type: %T\n", body["status"])
}
// Cargo.toml: reqwest = { version = "0.12", features = ["blocking", "json"] }
fn main() -> Result<(), Box> {
let resp = reqwest::blocking::get("https://not.catastrophic.io/problem-details")?;
println!("Content-Type: {:?}", resp.headers().get("content-type"));
println!("X-Chaos-Problem-Details-Mode: {:?}", resp.headers().get("x-chaos-problem-details-mode"));
let body: serde_json::Value = resp.json()?;
println!("type present: {}", body.get("type").is_some());
println!("status: {:?}", body.get("status"));
Ok(())
}
import java.net.URI;
import java.net.http.*;
public class ProblemDetailsChaos {
public static void main(String[] args) throws Exception {
var client = HttpClient.newHttpClient();
var req = HttpRequest.newBuilder(URI.create("https://not.catastrophic.io/problem-details")).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-Problem-Details-Mode: " +
resp.headers().firstValue("X-Chaos-Problem-Details-Mode").orElse(""));
System.out.println("Body: " + resp.body());
}
}
using var client = new HttpClient();
var resp = await client.GetAsync("https://not.catastrophic.io/problem-details");
Console.WriteLine($"Content-Type: {resp.Content.Headers.ContentType}");
Console.WriteLine($"X-Chaos-Problem-Details-Mode: " +
$"{resp.Headers.GetValues("X-Chaos-Problem-Details-Mode").FirstOrDefault()}");
var body = await resp.Content.ReadAsStringAsync();
Console.WriteLine($"Body: {body}");
require "net/http"
require "json"
uri = URI("https://not.catastrophic.io/problem-details")
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-Problem-Details-Mode: #{res['X-Chaos-Problem-Details-Mode']}"
body = JSON.parse(res.body)
puts "type present: #{body.key?('type')}"
puts "status type: #{body['status'].class}"
end
$r = Invoke-RestMethod -Uri 'https://not.catastrophic.io/problem-details' -ResponseHeadersVariable h
"Content-Type: $($h['Content-Type'])"
"X-Chaos-Problem-Details-Mode: $($h['X-Chaos-Problem-Details-Mode'])"
"type present: $($r.PSObject.Properties['type'] -ne $null)"
"status type: $($r.status.GetType().Name)"
headers
body