SERVER
[SERVER] HTTPํค๋ > content-type
GaGah
2023. 1. 26. 00:12
๐ฉ๐ป HTTP ํค๋
HTTP ํค๋๋ ํด๋ผ์ด์ธํธ์ ์๋ฒ๊ฐ ์๋ก ์์ฒญ/์๋ต์ ์ค ๋, API ์์ฒญ๊ฐ ๋๋ ์๋ต๊ฐ ์ธ์ ๋ถ๊ฐ์ ์ธ ์ ๋ณด๋ฅผ ์ ์กํ ์ ์๋๋ก ํด์ฃผ๋ ์ญํ ์ ํ๋ค.
header์๋ ๋ณดํต authorization(์ธ์ฆํ ํฐ), ์ฟ ํค, ํด๋ผ์ด์ธํธ์ ํ๋์จ์ด ์ ๋ณด ๋ฑ์ด ๋ด๊ฒจ์๋ค.
(์ด๋ฐ ์ ๋ณด๋ค์ ํตํด ๋ก๊ทธ/์ค๋ฅ ์ถ์ ๋ฑ์ ํ ์ ์๋ค.)
๐ CURL API ์ ๋ฌธ (Request Header ํ์ธ ๊ฐ๋ฅ)
-H ๋ Request Header๋ฅผ ์๋ฏธํ๋ค.
ํํ๋ "์ด๋ฆ" ":" "๊ฐ" ์ผ๋ก ๋์ด์๋ค.
curl 'https://cologger.shopping.naver.com//api/v1/collect/PLUS_DEAL/001051?adCntsSeqs=5899458&adCntsSeqs=5899725&adCntsSeqs=5899723' \
-H 'authority: cologger.shopping.naver.com' \
-H 'accept: application/json' \
-H 'accept-language: ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7' \
-H 'content-type: application/json' \
-H 'cookie: NNB=SIVW4SLTLIZGC; ASID=713d17a00000017bfb95bd7900000061; autocomplete=use; _ga_7VKFYR6RV1=GS1.1.1662453004.41.1.1662453007.57.0.0; AD_SHP_BID=13; nx_ssl=2; recent_card_list=1692,1531,1530,2612,1451; _tt_enable_cookie=1; _ttp=0-K7yeUOtiQKCkxkc5YiMcRw_28; _ga=GA1.2.625044960.1631345612; _ga_4BKHBFKFK0=GS1.1.1673163395.2.1.1673163781.60.0.0; nid_inf=1278450771; NID_JKL=9JkWxRR7jfKL31IOJrmcO4C0f3f+EV/dYUeXFXiQ1ug=; BMR=s=1674554101265&r=https%3A%2F%2Fm.blog.naver.com%2Fhisasi222%2F222306660161&r2=https%3A%2F%2Fwww.google.com%2F; page_uid=h8/Y8dp0Jy0ss5icmWNssssst/d-422353' \
-H 'origin: https://www.naver.com' \
-H 'referer: https://www.naver.com/' \
-H 'sec-ch-ua: "Not_A Brand";v="99", "Google Chrome";v="109", "Chromium";v="109"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "macOS"' \
-H 'sec-fetch-dest: empty' \
-H 'sec-fetch-mode: cors' \
-H 'sec-fetch-site: same-site' \
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36' \
--compressed
๐ฉ๐ป HTTP ํค๋ > Content-Type
Content-Type ํค๋๋ ๋ฆฌ์์ค์ media type์ ๋ํ๋ด์ค๋ค.
์์ฒญ/์๋ต ํ๋ API๊ฐ media๋ฅผ ํฌํจํ multipart ํํ์ธ์ง, text/html ํํ์ธ์ง, json ํํ์ธ์ง ๋ฑ๋ฑ
์ด๋ฅผ ํตํด ์๋ฒ๋ ์ฒ๋ฆฌ๊ฐ ํ์ํ ๋ด์ฉ์ด ๋ค๋ฅด๋ค.
๐ Content-Type ์์
Content-Type: text/html; charset=utf-8
Content-Type: multipart/form-data; boundary=something
๐ฉ๐ป ์ค์ ์๋ต ํค๋
ํ์ธ ๋ฐฉ๋ฒ
ํฌ๋กฌ ๊ฐ๋ฐ์ ๋๊ตฌ๋ฅผ ํค๋ฉด Response Headers > content-type ์ ํ์ธํ ์ ์๋ค.
๐ฉ๐ป HTTP ํค๋ ํน์ง
- ๋์๋ฌธ์ ๊ตฌ๋ถ ์์
๐ ์ฐธ๊ณ ๋งํฌ
LIST