diff --git a/back/src/wos/wos.service.ts b/back/src/wos/wos.service.ts index a649e0d..7f22b33 100644 --- a/back/src/wos/wos.service.ts +++ b/back/src/wos/wos.service.ts @@ -9,6 +9,15 @@ import { CouponLog } from '../entities/coupon-log.entity'; const SECRET = 'tB87#kPtkxqOS2'; const WOS_API_BASE = 'https://wos-giftcode-api.centurygame.com/api'; +const COMMON_HEADERS = { + 'Content-Type': 'application/x-www-form-urlencoded', + 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36', + 'Accept': 'application/json, text/plain, */*', + 'Accept-Language': 'ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7', + 'Origin': 'https://wos-giftcode.centurygame.com', + 'Referer': 'https://wos-giftcode.centurygame.com/', +}; + const ERR_MESSAGES: Record = { 20000: '쿠폰 코드가 존재하지 않습니다.', 20001: '이미 사용된 쿠폰입니다.', @@ -41,7 +50,7 @@ export class WosService { const response = await axios.post( `${WOS_API_BASE}/player`, new URLSearchParams({ fid, time: String(timestamp), sign }), - { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }, + { headers: { ...COMMON_HEADERS } }, ); const data = response.data; @@ -74,7 +83,7 @@ export class WosService { `${WOS_API_BASE}/captcha`, new URLSearchParams({ fid, time: String(timestamp), sign }), { - headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, + headers: { ...COMMON_HEADERS }, withCredentials: true, }, ); @@ -115,7 +124,7 @@ export class WosService { }), { headers: { - 'Content-Type': 'application/x-www-form-urlencoded', + ...COMMON_HEADERS, Cookie: sessionCookie, }, },