اختيار رموز الحالة
في هذا الدرس 4 موضوعات
هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
pick the status code that tells the client exactly what happened.
الموضوعات المخطط لها
2xxsuccess:200OK,201Created,204No Content.4xxclient mistake:400bad input,401not authenticated,403not allowed,404not found,409conflict,422valid shape but invalid meaning.5xxserver fault:500,503.- Creation returns
201, not200. A successful delete with no body returns204. - The status code is part of the contract; clients branch on it.
تفاصيل المخطط المبدئي
عرض عملي
| Situation | Code |
|---|---|
| Product created | 201 |
| Product not found | 404 |
| Duplicate SKU | 409 |
| Missing required field | 400 |
اختبر فهمك
Which code for "you are logged in but may not do this"?
أظهر الإجابة
403.
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.