HTTP Response คืออะไร

หมวดสำหรับแบ่งบันความ รู้ต่างๆ จะมีหมวดย่อยๆ ในหมวดนี้ เช่น php, SQL, XML, CSS

Moderator: mindphp, ผู้ดูแลกระดาน

ภาพประจำตัวสมาชิก
jirawoot
PHP VIP Members
PHP VIP Members
โพสต์: 3129
ลงทะเบียนเมื่อ: 17/06/2019 10:30 am

HTTP Response คืออะไร

โพสต์ที่ยังไม่ได้อ่าน โดย jirawoot »

HTTP Response คือ ข้อมูลที่ server ส่งกลับไปยัง client ที่มาจาก HTTP Request ตามที่ทาง client ร้องขอมา http respones จะมีส่วนประกอบสำคัญหลัก คือ http status code, http response headers, respones body
Selection_005.png
Selection_005.png (2.82 KiB) Viewed 4527 times
รหัสบอกสถานะ (http status code) คือเป็นรหัสที่ใช้บอกสถานะในการ request ครั้งนั้นได้รับการตอบรับว่าสำเร็จหรือไม่รหัสก็มีอยู่ 5 หมวด ด้วยกัน คือ
1xx: information
  • 100: Continue
    101: Switching Protocols
    102: Checkpoint
2xx: successful
  • 200: OK
    201: Created
    202: Accepted
    ยังไม่เสร็จ
    203: Non-Authoritative Information
    204: No Content
    205: Reset Content
    206: Partial Content
3xx: redirection
  • 300: Multiple Choices
    301: Moved Parmanently
    302: Found
    303: See Other
    304: Not Modified
4xx: client error
  • 400: Bad Request
    401: Unauthorized
    402: Payment Required
    403: Forbidden
    404: Not Found
    405: Method Not Allowed
    406: Not Acceptable
    413: Request Entity
    414: Request-URI
    415: Unsupported Media Type
5xx: server error
  • 500: Internal Server Error
    501: Not Implemented
    502: Bad Gateway
    503: Service Unavailable
    504: Gateway Timeout
response headers คือ ส่วนที่เป็นข้อมูลเพิ่มเติม เช่น ขนาดของข้อมูลว่ามีขนาดเท่าไร ประเภทอะไร ตัวอย่าง เช่น
Selection_006.png
Selection_006.png (41.84 KiB) Viewed 4527 times
response body คือ ในส่วนจะเป็นข้อมูลหรือเนื้อความของข้อมูลจริงที่ ทางserver ส่งกลับไปยัง client ที่จะต้องแสดงลงบน web browser

อธิบายแบบละเอียดๆ จะบทความนี้
https://www.mindphp.com/developer/26-%E ... tions.html
(Eng)

อ้างอิง
https://www.anurocha.com/2016/07/28/http-basic/
https://www.medium.com/quintuples/สิ่งที่ต้องรู้ทำความเข้าใจก่อนเขียน-test-rest-apis-with-postman-a85a274992b5
https://www.swiftlet.co.th/learn/http-protocol/
  • Similar Topics
    ตอบกลับ
    แสดง
    โพสต์ล่าสุด

ผู้ใช้งานขณะนี้

สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 83