Content Negotiation
콘텐츠 협상
콘텐츠 협상은 HTTP가 클라이언트의 선호와 서버의 사용 가능한 형식 중 하나를 선택하는 방법입니다.
다른 예시
보고서 API는 `Accept`에 따라 `application/json` 또는 `text/csv`를 전송합니다. 두 항목 모두 작동하지 않으면 406을 반환하고 `Vary: Accept`를 추가합니다. 이는 캐시가 JSON 클라이언트에 CSV를 보내는 것을 방지합니다. 언어는 별도로 선택되며, 모든 응답에는 명확한 `Content-Type`이 포함됩니다.
주요 부분
- 01클라이언트 환경 설정
- 02사용 가능한 표현
- 03선택된 응답 및 Vary
사용할 때
한 리소스가 실제로 다른 미디어, 언어, 인코딩 또는 선호 버전을 가질 경우 표준 요청 헤더를 사용하세요.
다음 경우에는 사용하지 마세요
캐시가 구분할 수 없는 버전을 만들지 마세요. 서버가 지원하지 않는 필수 미디어 유형을 조용히 무시하지 마세요.
코드에서 사용된 이름
Accept / Accept-Language / Accept-Encoding + Content-Type / Content-Language + Vary 출시하기 전에
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 콘텐츠 협상 (Content Negotiation)。 User context:보고서 API는 `Accept`에 따라 `application/json` 또는 `text/csv`를 전송합니다. 두 항목 모두 작동하지 않으면 406을 반환하고 `Vary: Accept`를 추가합니다. 이는 캐시가 JSON 클라이언트에 CSV를 보내는 것을 방지합니다. 언어는 별도로 선택되며, 모든 응답에는 명확한 `Content-Type`이 포함됩니다. Technical concept or control:콘텐츠 협상 (Content Negotiation)。 Why it fits:한 리소스가 실제로 다른 미디어, 언어, 인코딩 또는 선호 버전을 가질 경우 표준 요청 헤더를 사용하세요. Do not use it when:캐시가 구분할 수 없는 버전을 만들지 마세요. 서버가 지원하지 않는 필수 미디어 유형을 조용히 무시하지 마세요. 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):이 표준은 나열된 범위만 적용합니다. 시각적 스타일, 제품 결정, 또는 Vibulary 예시는 선택하지 않습니다. 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.
이 요청을 확인하세요
Review how 콘텐츠 협상 (Content Negotiation) is used now. Definition: 콘텐츠 협상은 HTTP가 클라이언트의 선호와 서버의 사용 가능한 형식 중 하나를 선택하는 방법입니다. 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.