HTTP Status Code
HTTP-Statuscode
Ein HTTP-Statuscode ist eine dreistellige Zahl in einer Antwort. Er gibt das Standardergebnis der Anfrage an und zu welcher Ergebnisgruppe es gehört.
Ein weiteres Beispiel
Eine Import-API gibt 202 und eine Status-URL zurück, während die Arbeit fortgesetzt wird. Sie gibt 201 mit `Location` nach einer unmittelbaren Erstellung zurück. Sie gibt 409 bei einem Versionskonflikt und 422 für CSV-Felder mit ungültiger Bedeutung zurück. Ein JSON-Problem-Body fügt nützliche Details hinzu, ohne die Bedeutung des Codes zu ändern.
Hauptteile
- 01Statusklasse
- 02registrierter Code
- 03Antwort-Metadaten und -Inhalt
Verwenden Sie es, wenn
Gib den genauesten registrierten Code zurück, der zum Ergebnis passt. Füge bei Bedarf nützliche Header und einen stabilen Fehlerkörper hinzu.
Nutze es nicht, wenn
Geben Sie nicht für jedes geschäftliche Scheitern eine 200 zurück. Vermeiden Sie außerdem Fehler, die so spezifisch sind, dass geheime Autorisierungsdetails preisgegeben werden.
In Code verwendeter Name
1xx informational, 2xx success, 3xx redirection, 4xx client, 5xx server Vor dem Ausliefern
Check contracts and invariants, authorization, and input limits. Test retries, one-time effects, timeouts, and partial failures. Verify data integrity, compatibility, monitoring, recovery, and rollback.
Outcome: Complete the task with HTTP-Statuscode (HTTP Status Code). User context: Eine Import-API gibt 202 und eine Status-URL zurück, während die Arbeit fortgesetzt wird. Sie gibt 201 mit `Location` nach einer unmittelbaren Erstellung zurück. Sie gibt 409 bei einem Versionskonflikt und 422 für CSV-Felder mit ungültiger Bedeutung zurück. Ein JSON-Problem-Body fügt nützliche Details hinzu, ohne die Bedeutung des Codes zu ändern. Technical concept or control: HTTP-Statuscode (HTTP Status Code). Why it fits: Gib den genauesten registrierten Code zurück, der zum Ergebnis passt. Füge bei Bedarf nützliche Header und einen stabilen Fehlerkörper hinzu. Do not use it when: Geben Sie nicht für jedes geschäftliche Scheitern eine 200 zurück. Vermeiden Sie außerdem Fehler, die so spezifisch sind, dass geheime Autorisierungsdetails preisgegeben werden. Engineering requirements: Define inputs, outputs, contracts, and rules that must always hold. Set authorization and input checks. Define failures, timeouts, retries, one-time effects, data moves, and compatibility limits. Operations: Add useful signals and logs that hide sensitive data. Set capacity limits and write an operator guide. Test recovery and rollback. Acceptance criteria: Contract and failure-path tests pass. Data and authorization rules still hold during retries and partial failures. Check performance limits, monitoring, recovery, and rollback. Evidence and limits (evidence boundary): Der Standard deckt nur den aufgeführten Umfang ab. Er wählt nicht den visuellen Stil, die Produktentscheidung oder das Vibulary-Beispiel aus. Unknowns to confirm: Where the code runs, data stores, traffic shape, consistency needs, and the security boundary. Also confirm the compatibility period, service goals, and rollback limits.
Diese Anfrage prüfen
Review how HTTP-Statuscode (HTTP Status Code) is used now. Definition: Ein HTTP-Statuscode ist eine dreistellige Zahl in einer Antwort. Er gibt das Standardergebnis der Anfrage an und zu welcher Ergebnisgruppe es gehört. Release checks: Check contracts and invariants, authorization, and input limits. Test retries, one-time effects, timeouts, and partial failures. Verify data integrity, compatibility, monitoring, recovery, and rollback. Before changing code, list the evidence, gaps, severity, and the smallest safe fix.