]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
🌐 Add Korean translation for `ko/docs/advanced/response-headers.md` (#12740)
authorLKY <74170199+kwang1215@users.noreply.github.com>
Fri, 8 Nov 2024 19:42:29 +0000 (04:42 +0900)
committerGitHub <noreply@github.com>
Fri, 8 Nov 2024 19:42:29 +0000 (19:42 +0000)
docs/ko/docs/advanced/response-headers.md [new file with mode: 0644]

diff --git a/docs/ko/docs/advanced/response-headers.md b/docs/ko/docs/advanced/response-headers.md
new file mode 100644 (file)
index 0000000..54cf655
--- /dev/null
@@ -0,0 +1,45 @@
+# μ‘λ‹΅ ν—€λ”
+
+## `Response` λ§€κ°œλ³€μˆ˜ μ‚¬μš©ν•˜κΈ°
+
+μ—¬λŸ¬λΆ„μ€ *경둜 μž‘동 ν•¨μˆ˜*μ—μ„œ `Response` νƒ€μž…μ˜ λ§€κ°œλ³€μˆ˜λ₯Ό μ„ μ–Έν•  μˆ˜ μžˆμŠ΅λ‹ˆλ‹€ (쿠킀와 κ°™μ΄ μ‚¬μš©ν•  μˆ˜ μžˆμŠ΅λ‹ˆλ‹€).
+
+그런 λ‹€μŒ, μ—¬λŸ¬λΆ„은 ν•΄λ‹Ή *μž„μ‹œ* μ‘λ‹΅ κ°μ²΄μ—μ„œ ν—€λ”λ₯Ό μ„€μ •ν•  μˆ˜ μžˆμŠ΅λ‹ˆλ‹€.
+
+```Python hl_lines="1  7-8"
+{!../../docs_src/response_headers/tutorial002.py!}
+```
+
+κ·Έ ν›„, μΌλ°˜μ μœΌλ‘œ μ‚¬μš©ν•˜λ“―이 ν•„μš”ν•œ κ°μ²΄(`dict`, λ°μ΄ν„°λ² μ΄μŠ€ λͺ¨λΈ λ“±)λ₯Ό λ°˜ν™˜ν•  μˆ˜ μžˆμŠ΅λ‹ˆλ‹€.
+
+`response_model`을 μ„ μ–Έν•œ κ²½μš°, λ°˜ν™˜ν•œ κ°μ²΄λ₯Ό ν•„ν„°λ§ν•˜κ³  λ³€ν™˜ν•˜λŠ” λ° μ—¬μ „νžˆ μ‚¬μš©λ©λ‹ˆλ‹€.
+
+**FastAPI**λŠ” ν•΄λ‹Ή *μž„μ‹œ* μ‘λ‹΅μ—μ„œ ν—€λ”(쿠킀와 μƒνƒœ μ½”λ“œλ„ ν¬ν•¨)λ₯Ό μΆ”μΆœν•˜μ—¬, μ—¬λŸ¬λΆ„이 λ°˜ν™˜ν•œ κ°’을 ν¬ν•¨ν•˜λŠ” μ΅œμ’… μ‘닡에 `response_model`둜 ν•„ν„°λ§λœ κ°’을 λ„£μŠ΅λ‹ˆλ‹€.
+
+λ˜ν•œ, μ’…μ†μ„±μ—μ„œ `Response` λ§€κ°œλ³€μˆ˜λ₯Ό μ„ μ–Έν•˜κ³  κ·Έ μ•ˆμ—μ„œ ν—€λ”(및 μΏ ν‚€)λ₯Ό μ„€μ •ν•  μˆ˜ μžˆμŠ΅λ‹ˆλ‹€.
+
+## `Response` μ§μ ‘ λ°˜ν™˜ν•˜κΈ°
+
+`Response`λ₯Ό μ§μ ‘ λ°˜ν™˜ν•  λ•Œμ—λ„ ν—€λ”λ₯Ό μΆ”κ°€ν•  μˆ˜ μžˆμŠ΅λ‹ˆλ‹€.
+
+[응닡을 μ§μ ‘ λ°˜ν™˜ν•˜κΈ°](response-directly.md){.internal-link target=_blank}μ—μ„œ μ„€λͺ…ν•œ λŒ€λ‘œ μ‘닡을 μƒμ„±ν•˜κ³ , ν—€λ”λ₯Ό μΆ”κ°€ λ§€κ°œλ³€μˆ˜λ‘œ μ „λ‹¬ν•˜μ„Έμš”.
+
+```Python hl_lines="10-12"
+{!../../docs_src/response_headers/tutorial001.py!}
+```
+
+/// note | "기술적 μ„ΈλΆ€μ‚¬ν•­"
+
+`from starlette.responses import Response`λ‚˜ `from starlette.responses import JSONResponse`λ₯Ό μ‚¬μš©ν•  μˆ˜λ„ μžˆμŠ΅λ‹ˆλ‹€.
+
+**FastAPI**λŠ” `starlette.responses`λ₯Ό `fastapi.responses`둜 κ°œλ°œμžμ˜ νŽΈμ˜λ₯Ό μœ„ν•΄ μ§μ ‘ μ œκ³΅ν•˜μ§€λ§Œ, λŒ€λΆ€λΆ„μ˜ μ‘닡은 Starletteμ—μ„œ μ§μ ‘ μ œκ³΅λ©λ‹ˆλ‹€.
+
+그리고 `Response`λŠ” ν—€λ”와 μΏ ν‚€λ₯Ό μ„€μ •ν•˜λŠ” λ° μžμ£Ό μ‚¬μš©λ  μˆ˜ μžˆμœΌλ―€λ‘œ, **FastAPI**λŠ” `fastapi.Response`λ‘œλ„ μ΄λ₯Ό μ œκ³΅ν•©λ‹ˆλ‹€.
+
+///
+
+## μ»€μŠ€ν…€ ν—€λ”
+
+<a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers" class="external-link" target="_blank">β€˜X-’ μ ‘두어λ₯Ό μ‚¬μš©ν•˜μ—¬</a> μ»€μŠ€ν…€ μ‚¬μ„€ ν—€λ”λ₯Ό μΆ”κ°€ν•  μˆ˜ μžˆμŠ΅λ‹ˆλ‹€.
+
+ν•˜μ§€λ§Œ, μ—¬λŸ¬λΆ„이 λΈŒλΌμš°μ €μ—μ„œ ν΄λΌμ΄μ–ΈνŠΈκ°€ λ³Ό μˆ˜ μžˆκΈ°λ₯Ό μ›ν•˜λŠ” μ»€μŠ€ν…€ ν—€λ”κ°€ μžˆλŠ” κ²½μš°, CORS μ„€μ •에 μ΄λ₯Ό μΆ”κ°€ν•΄μ•Ό ν•©λ‹ˆλ‹€([CORS (Cross-Origin Resource Sharing)](../tutorial/cors.md){.internal-link target=_blank}μ—μ„œ μžμ„Ένžˆ μ•Œμ•„λ³΄μ„Έμš”). `expose_headers` λ§€κ°œλ³€μˆ˜λ₯Ό μ‚¬μš©ν•˜μ—¬ <a href="https://www.starlette.io/middleware/#corsmiddleware" class="external-link" target="_blank">Starlette의 CORS μ„€λͺ…μ„œ</a>에 λ¬Έμ„œν™”λœ λŒ€λ‘œ μ„€μ •ν•  μˆ˜ μžˆμŠ΅λ‹ˆλ‹€.