GET /wrong-content-type
Returns a body whose declared Content-Type does not match its actual format. Default sends a JSON body labelled text/html. Other modes mismatch JSON-as-PNG, XML-as-JSON, HTML-as-JSON, or omit the Content-Type entirely. The X-Chaos-Body-Format header exposes the body's real format so clients can detect the mismatch programmatically.
type
Mismatch flavor. One of: json-as-html (default), xml-as-json, html-as-json, json-as-png, missing.
control Compare against the well-formed counterpart: not.catastrophic.io/wrong-content-type side-by-side
build a request:
expect: A body whose Content-Type lies about its actual format. The X-Chaos-Body-Format response header reveals the real type.
curl -i 'https://chaos.catastrophic.io/wrong-content-type?type=json-as-html'
import urllib.request
resp = urllib.request.urlopen("https://chaos.catastrophic.io/wrong-content-type?type=json-as-html")
print("Declared:", resp.headers.get("Content-Type"))
print("Actual:", resp.headers.get("X-Chaos-Body-Format"))
print(resp.read().decode())
const res = await fetch("https://chaos.catastrophic.io/wrong-content-type?type=json-as-html");
console.log("Content-Type:", res.headers.get("content-type"));
console.log(await res.text());
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
resp, _ := http.Get("https://chaos.catastrophic.io/wrong-content-type?type=json-as-html")
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println("Content-Type:", resp.Header.Get("Content-Type"))
fmt.Println(string(body))
}
// Cargo.toml: reqwest = { version = "0.12", features = ["blocking"] }
fn main() -> Result<(), Box> {
let resp = reqwest::blocking::get("https://chaos.catastrophic.io/wrong-content-type?type=json-as-html")?;
println!("Content-Type: {:?}", resp.headers().get("content-type"));
println!("{}", resp.text()?);
Ok(())
}
import java.net.URI;
import java.net.http.*;
public class WrongContentType {
public static void main(String[] args) throws Exception {
var client = HttpClient.newHttpClient();
var req = HttpRequest.newBuilder(URI.create("https://chaos.catastrophic.io/wrong-content-type?type=json-as-html")).build();
var resp = client.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println("Content-Type: " + resp.headers().firstValue("Content-Type").orElse(""));
System.out.println(resp.body());
}
}
using var client = new HttpClient();
var resp = await client.GetAsync("https://chaos.catastrophic.io/wrong-content-type?type=json-as-html");
Console.WriteLine($"Content-Type: {resp.Content.Headers.ContentType}");
Console.WriteLine(await resp.Content.ReadAsStringAsync());
require "net/http"
res = Net::HTTP.get_response(URI("https://chaos.catastrophic.io/wrong-content-type?type=json-as-html"))
puts "Content-Type: #{res["Content-Type"]}"
puts res.body
# Invoke-RestMethod respects Content-Type and will NOT auto-parse
# this as JSON despite the body being valid JSON.
$r = Invoke-WebRequest -Uri 'https://chaos.catastrophic.io/wrong-content-type?type=json-as-html'
$r.Headers['Content-Type']
$r.Content
headers
body