SMTP

Giả lập phản hồi 535 Authentication Failed

The authentication credentials provided are invalid. The username, password, or authentication mechanism was rejected by the server.

Xem tài liệu tham khảo đầy đủ →

1 Phản hồi HTTP

Phản hồi HTTP
HTTP/1.1 535 Authentication Failed
Content-Type: application/json
Date: Tue, 25 Feb 2026 12:00:00 GMT
Content-Length: 61

{
  "error": "server_error",
  "message": "Authentication Failed"
}

2 Kiểm tra với curl

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

3 Trả về 535 Authentication Failed trong Framework của bạn

django
from django.http import JsonResponse


def my_view(request):
    return JsonResponse(
        {"error": "server_error", "message": "Authentication Failed"},
        status=535,
    )
flask
from flask import Flask, jsonify

app = Flask(__name__)


@app.route("/endpoint")
def my_endpoint():
    return jsonify({"error": "server_error", "message": "Authentication Failed"}), 535
fastapi
from fastapi import FastAPI
from fastapi.responses import JSONResponse

app = FastAPI()


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

Thêm trang giả lập SMTP