GET /jwt-payload
/jwt-payloadReturns a well-formed JWT payload (claim set): `iss` is a URI, `sub` is a string principal identifier, `aud` is a homogeneous array of StringOrURI values, `exp` and `iat` are NumericDate integers. Counterpart to /jwt-payload, which ships one of four RFC 7519 violations.
expect: 200 OK with Content-Type: application/json. Body is an RFC 7519 compliant claim set with correctly-typed registered claims. Build JWT deserializers against this, then flip hostname to chaos.catastrophic.io to test adversity.
curl -si 'https://not.catastrophic.io/jwt-payload' | grep -E '^(HTTP|content-type|x-chaos)'
import urllib.request, json
resp = urllib.request.urlopen("https://not.catastrophic.io/jwt-payload")
print("Content-Type:", resp.headers.get("Content-Type"))
print("X-Chaos-Jwt-Payload-Mode:", resp.headers.get("X-Chaos-Jwt-Payload-Mode"))
body = json.loads(resp.read())
print("exp type:", type(body.get("exp")).__name__)
print("iss:", body.get("iss"))
print("aud:", body.get("aud"))
print("note:", body.get("note"))
const res = await fetch("https://not.catastrophic.io/jwt-payload");
const body = await res.json();
console.log("Content-Type:", res.headers.get("content-type"));
console.log("X-Chaos-Jwt-Payload-Mode:", res.headers.get("x-chaos-jwt-payload-mode"));
console.log("exp value:", body.exp, "/ typeof:", typeof body.exp);
console.log("iss:", body.iss);
console.log("aud:", body.aud);
console.log("note:", body.note);
package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
resp, _ := http.Get("https://not.catastrophic.io/jwt-payload")
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-Jwt-Payload-Mode:", resp.Header.Get("X-Chaos-Jwt-Payload-Mode"))
fmt.Printf("exp value: %v (Go type: %T)\n", body["exp"], body["exp"])
fmt.Printf("iss: %v\n", body["iss"])
fmt.Printf("aud: %v\n", body["aud"])
}
// Cargo.toml: reqwest = { version = "0.12", features = ["blocking", "json"] }
fn main() -> Result<(), Box> {
let resp = reqwest::blocking::get("https://not.catastrophic.io/jwt-payload")?;
println!("Content-Type: {:?}", resp.headers().get("content-type"));
println!("X-Chaos-Jwt-Payload-Mode: {:?}", resp.headers().get("x-chaos-jwt-payload-mode"));
let body: serde_json::Value = resp.json()?;
println!("exp: {:?}", body.get("exp"));
println!("iss: {:?}", body.get("iss"));
println!("aud: {:?}", body.get("aud"));
Ok(())
}
import java.net.URI;
import java.net.http.*;
public class JwtPayloadChaos {
public static void main(String[] args) throws Exception {
var client = HttpClient.newHttpClient();
var req = HttpRequest.newBuilder(URI.create("https://not.catastrophic.io/jwt-payload")).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-Jwt-Payload-Mode: " +
resp.headers().firstValue("X-Chaos-Jwt-Payload-Mode").orElse(""));
System.out.println("Body: " + resp.body());
}
}
using var client = new HttpClient();
var resp = await client.GetAsync("https://not.catastrophic.io/jwt-payload");
Console.WriteLine($"Content-Type: {resp.Content.Headers.ContentType}");
Console.WriteLine($"X-Chaos-Jwt-Payload-Mode: " +
$"{resp.Headers.GetValues("X-Chaos-Jwt-Payload-Mode").FirstOrDefault()}");
var body = await resp.Content.ReadAsStringAsync();
Console.WriteLine($"Body: {body}");
require "net/http"
require "json"
uri = URI("https://not.catastrophic.io/jwt-payload")
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-Jwt-Payload-Mode: #{res['X-Chaos-Jwt-Payload-Mode']}"
body = JSON.parse(res.body)
puts "exp class: #{body['exp'].class}"
puts "iss: #{body['iss']}"
puts "aud: #{body['aud'].inspect}"
end
$r = Invoke-RestMethod -Uri 'https://not.catastrophic.io/jwt-payload' -ResponseHeadersVariable h
"Content-Type: $($h['Content-Type'])"
"X-Chaos-Jwt-Payload-Mode: $($h['X-Chaos-Jwt-Payload-Mode'])"
"exp value: $($r.exp) / type: $($r.exp.GetType().Name)"
"iss: $($r.iss)"
"aud: $($r.aud -join ', ')"
headers
body