SMTP
Mock Respons 502 Command Not Implemented
The command is recognized by the SMTP specification but is not implemented on this server. The server understands the command but has chosen not to support it.
Lihat referensi lengkap →1 Respons HTTP
HTTP/1.1 502 Command Not Implemented
Content-Type: application/json
Date: Tue, 25 Feb 2026 12:00:00 GMT
Content-Length: 60
{
"error": "bad_gateway",
"message": "Upstream server error"
}
2 Uji dengan curl
curl -i https://httpbin.org/status/502
3 Kembalikan 502 Command Not Implemented di Framework Anda
django
from django.http import JsonResponse
def my_view(request):
return JsonResponse(
{"error": "bad_gateway", "message": "Upstream server error"},
status=502,
)
flask
from flask import Flask, jsonify
app = Flask(__name__)
@app.route("/endpoint")
def my_endpoint():
return jsonify({"error": "bad_gateway", "message": "Upstream server error"}), 502
fastapi
from fastapi import FastAPI
from fastapi.responses import JSONResponse
app = FastAPI()
@app.get("/endpoint")
def my_endpoint():
return JSONResponse(
content={"error": "bad_gateway", "message": "Upstream server error"},
status_code=502,
)
express.js
// Express.js
app.get('/endpoint', (req, res) => {
res.status(502).json({"error": "bad_gateway", "message": "Upstream server error"});
});
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(502)
.body(Map.of("error", "command_not_implemented",
"message", "Command Not Implemented"));
}
}
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(502)
json.NewEncoder(w).Encode(map[string]string{
"error": "command_not_implemented",
"message": "Command Not Implemented",
})
}
ruby on rails
class MyController < ApplicationController
def my_action
render json: {"error": "bad_gateway", "message": "Upstream server error"},
status: :command_not_implemented
end
end
asp.net core
// ASP.NET Core Minimal API
app.MapGet("/endpoint", () =>
Results.Json(
new { error = "command_not_implemented", message = "Command Not Implemented" },
statusCode: 502
)
);