SIP

420 Bad Extension レスポンスのモック

The server did not understand the protocol extension specified in a Require or Proxy-Require header. The Unsupported header lists the unknown extensions.

完全なリファレンスを見る →

1 HTTP レスポンス

HTTP レスポンス
HTTP/1.1 420 Bad Extension
Content-Type: application/json
Date: Tue, 25 Feb 2026 12:00:00 GMT
Content-Length: 54

{
  "error": "bad_extension",
  "message": "Bad Extension"
}

2 curl でテストする

terminal
curl -i https://httpbin.org/status/420

3 フレームワークで 420 Bad Extension を返す

django
from django.http import JsonResponse


def my_view(request):
    return JsonResponse(
        {"error": "bad_extension", "message": "Bad Extension"},
        status=420,
    )
flask
from flask import Flask, jsonify

app = Flask(__name__)


@app.route("/endpoint")
def my_endpoint():
    return jsonify({"error": "bad_extension", "message": "Bad Extension"}), 420
fastapi
from fastapi import FastAPI
from fastapi.responses import JSONResponse

app = FastAPI()


@app.get("/endpoint")
def my_endpoint():
    return JSONResponse(
        content={"error": "bad_extension", "message": "Bad Extension"},
        status_code=420,
    )
express.js
// Express.js
app.get('/endpoint', (req, res) => {
  res.status(420).json({"error": "bad_extension", "message": "Bad Extension"});
});
spring boot
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.Map;

@RestController
public class MyController {

    @GetMapping("/endpoint")
    public ResponseEntity<Map<String, Object>> myEndpoint() {
        return ResponseEntity
            .status(420)
            .body(Map.of("error", "bad_extension",
                         "message", "Bad Extension"));
    }
}
go net/http
package main

import (
    "encoding/json"
    "net/http"
)

func myHandler(w http.ResponseWriter, r *http.Request) {
    w.Header().Set("Content-Type", "application/json")
    w.WriteHeader(420)
    json.NewEncoder(w).Encode(map[string]string{
        "error":   "bad_extension",
        "message": "Bad Extension",
    })
}
ruby on rails
class MyController < ApplicationController
  def my_action
    render json: {"error": "bad_extension", "message": "Bad Extension"},
           status: :bad_extension
  end
end
asp.net core
// ASP.NET Core Minimal API
app.MapGet("/endpoint", () =>
    Results.Json(
        new { error = "bad_extension", message = "Bad Extension" },
        statusCode: 420
    )
);

他の SIP モックページ