HTTP

Mock 415 Unsupported Media Type Response

The server refuses to accept the request because the Content-Type is not supported.

View full reference →

1 HTTP Response

HTTP Response
HTTP/1.1 415 Unsupported Media Type
Content-Type: application/json
Date: Tue, 25 Feb 2026 12:00:00 GMT
Content-Length: 72

{
  "error": "unsupported_media_type",
  "message": "Unsupported Media Type"
}

2 Test with curl

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

3 Return 415 Unsupported Media Type in Your Framework

django
from django.http import JsonResponse


def my_view(request):
    return JsonResponse(
        {"error": "unsupported_media_type", "message": "Unsupported Media Type"},
        status=415,
    )
flask
from flask import Flask, jsonify

app = Flask(__name__)


@app.route("/endpoint")
def my_endpoint():
    return jsonify({"error": "unsupported_media_type", "message": "Unsupported Media Type"}), 415
fastapi
from fastapi import FastAPI
from fastapi.responses import JSONResponse

app = FastAPI()


@app.get("/endpoint")
def my_endpoint():
    return JSONResponse(
        content={"error": "unsupported_media_type", "message": "Unsupported Media Type"},
        status_code=415,
    )
express.js
// Express.js
app.get('/endpoint', (req, res) => {
  res.status(415).json({"error": "unsupported_media_type", "message": "Unsupported Media Type"});
});
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(415)
            .body(Map.of("error", "unsupported_media_type",
                         "message", "Unsupported Media Type"));
    }
}
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(415)
    json.NewEncoder(w).Encode(map[string]string{
        "error":   "unsupported_media_type",
        "message": "Unsupported Media Type",
    })
}
ruby on rails
class MyController < ApplicationController
  def my_action
    render json: {"error": "unsupported_media_type", "message": "Unsupported Media Type"},
           status: :unsupported_media_type
  end
end
asp.net core
// ASP.NET Core Minimal API
app.MapGet("/endpoint", () =>
    Results.Json(
        new { error = "unsupported_media_type", message = "Unsupported Media Type" },
        statusCode: 415
    )
);

More HTTP Mock Pages