WebSocket

Giả lập phản hồi 1014 Bad Gateway

The server acting as a gateway or proxy received an invalid response from an upstream server it accessed while attempting to fulfill the request.

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

1 Phản hồi HTTP

Phản hồi HTTP
HTTP/1.1 1014 Bad Gateway
Content-Type: application/json
Date: Tue, 25 Feb 2026 12:00:00 GMT

2 Kiểm tra với curl

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

3 Trả về 1014 Bad Gateway trong Framework của bạn

django
from django.http import HttpResponse


def my_view(request):
    return HttpResponse(status=1014)  # Bad Gateway
flask
from flask import Flask

app = Flask(__name__)


@app.route("/endpoint")
def my_endpoint():
    return "", 1014  # Bad Gateway
fastapi
from fastapi import FastAPI
from fastapi.responses import Response

app = FastAPI()


@app.get("/endpoint")
def my_endpoint():
    return Response(status_code=1014)  # Bad Gateway
express.js
// Express.js
app.get('/endpoint', (req, res) => {
  res.sendStatus(1014); // Bad Gateway
});
spring boot
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
public class MyController {

    @GetMapping("/endpoint")
    public ResponseEntity<Void> myEndpoint() {
        return ResponseEntity
            .status(1014) // Bad Gateway
            .build();
    }
}
go net/http
package main

import "net/http"

func myHandler(w http.ResponseWriter, r *http.Request) {
    w.WriteHeader(1014) // Bad Gateway
}
ruby on rails
class MyController < ApplicationController
  def my_action
    head :bad_gateway
  end
end
asp.net core
// ASP.NET Core Minimal API
app.MapGet("/endpoint", () =>
    Results.StatusCode(1014) // Bad Gateway
);

Thêm trang giả lập WebSocket