From da78a9e329e272dedb2400b79a3bdeebff387d47 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:17 -0500 Subject: initial commit --- .../api/xmlhttprequest/setrequestheader/index.html | 55 ++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 files/ko/web/api/xmlhttprequest/setrequestheader/index.html (limited to 'files/ko/web/api/xmlhttprequest/setrequestheader') diff --git a/files/ko/web/api/xmlhttprequest/setrequestheader/index.html b/files/ko/web/api/xmlhttprequest/setrequestheader/index.html new file mode 100644 index 0000000000..c7c595e1f1 --- /dev/null +++ b/files/ko/web/api/xmlhttprequest/setrequestheader/index.html @@ -0,0 +1,55 @@ +--- +title: XMLHttpRequest.setRequestHeader() +slug: Web/API/XMLHttpRequest/setRequestHeader +translation_of: Web/API/XMLHttpRequest/setRequestHeader +--- +

{{APIRef('XMLHttpRequest')}}

+ +

XMLHttpRequest.setRequestHeader() 메소드는 HTTP요청 헤더의 값을 설정합니다. 반드시 setRequestHeader()를 open()뒤에 호출하여야 하며, 또한 send()가 호출되기 전에 호출해야 합니다. 만약 이 메소드가 같은 헤더에 대하여 여러번 호출이 되면, 그 값은 단일 요청 헤더에 병합됩니다.

+ +

만약 이것을 이용해 {{HTTPHeader("Accept")}} 헤더를 설정하지 않으면, {{domxref("XMLHttpRequest.send", "send()")}}가 호출될 때 Accept 헤더가 */*와 함께 전송됩니다.

+ +

보안상의 이유로, 어떤 헤더는 오직 사용자 에이전트에 의해서만 관리될 수 있습니다. 이 헤더는 {{Glossary("Forbidden_header_name", "forbidden header names", 1)}}와 {{Glossary("Forbidden_response_header_name", "forbidden response header names", 1)}}를 포함합니다.

+ +
+

여러분의 필드에 대해서, 상호교차(cross-domain) 요청시 "not allowed by Access-Control-Allow-Headers in preflight response" Exception이 나타날 수 있습니다. 이런 경우, "Access-Control-Allow-Headers"를 서버 측 응답 헤더에 설정하면 됩니다.

+
+ +

구문

+ +
myReq.setRequestHeader(header, value);
+
+ +

매개변수

+ +
+
header
+
설정 될 값을 가진 헤더의 이름
+
value
+
헤더의 본문(body)에 설정될 값
+
+ +

명세

+ + + + + + + + + + + + + + +
명세상태코멘트
{{SpecName('XMLHttpRequest', '#the-setRequestHeader()-method', 'setRequestHeader()')}}{{Spec2('XMLHttpRequest')}}WHATWG living standard
+ +

브라우저 호환성

+ +
{{Compat("api.XMLHttpRequest.setRequestHeader")}}
+ +

더 보기

+ +

Using XMLHttpRequest

-- cgit v1.2.3-54-g00ecf