Request(요청) vs Response(응답)

김기훈·2025년 12월 10일

이론

목록 보기
3/10
post-thumbnail

Request

  • 클라이언트 → 서버로 보내는 데이터

    • 즉, 사용자가 API를 호출할 때 입력하는 값
- Request Body

POST /api/v1/qna/questions
{
  "title": "질문 제목",
  "content": "내용",
  "category": 3,
  "image_urls": ["https://..."]
}

Request 흐름

  • 클라이언트 → request.dataSerializer(data=...)is_valid()save()


Response

  • 서버 → 클라이언트로 돌려주는 데이터

    • 즉, 서버가 처리한 뒤 결과로 반환하는 값
{
  "id": 10,
  "title": "질문 제목",
  "content": "내용",
  "category": 3,
  "images": [
    { "img_url": "https://..." }
  ],
  "created_at": "2025-12-10T12:00:00"
}

Response 흐름

  • Serializer(instance=생성된 question) → serializer.data → 클라이언트로 응답 반환


profile
안녕하세요.

0개의 댓글