GET /problem-details
Returns RFC 9457 Problem Details objects with spec violations. Default drops the required `type` field. Use ?mode= to isolate other violations: `status` as a string, a non-URI `instance`, or a Content-Type that claims application/json instead of application/problem+json.
mode
drop-required (default; `type` field omitted; RFC 9457 §3 requires it; clients that branch on type for error routing receive undefined), status-type-shift (`status` is the string "404" instead of integer 404; typed SDKs that deserialize into an int field error), instance-malformed (`instance` is the bare word "not-a-uri"; clients that dereference it get a URL parse error), content-type-lie (body is valid Problem Details JSON but Content-Type is application/json; clients that dispatch on the media type miss the error envelope).
control Compare against the well-formed counterpart: not.catastrophic.io/problem-details side-by-side
build a request:
expect: A JSON error envelope served with one RFC 9457 violation. The `note` field explains what is wrong. Content-Type is application/problem+json unless content-type-lie mode is active.
curl -si 'https://chaos.catastrophic.io/problem-details?mode=drop-required' | grep -E '^(HTTP|content-type|x-chaos)'
import urllib.request, json
resp = urllib.request.urlopen("https://chaos.catastrophic.io/problem-details?mode=drop-required")
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://chaos.catastrophic.io/problem-details?mode=drop-required");
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://chaos.catastrophic.io/problem-details?mode=drop-required")
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://chaos.catastrophic.io/problem-details?mode=drop-required")?;
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://chaos.catastrophic.io/problem-details?mode=drop-required")).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://chaos.catastrophic.io/problem-details?mode=drop-required");
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://chaos.catastrophic.io/problem-details?mode=drop-required")
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://chaos.catastrophic.io/problem-details?mode=drop-required' -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