메뉴 건너뛰기

infra

[method] 서버 메소드 테스트 및 응답 헤더 출력

lispro062018.07.27 23:18조회 수 141댓글 0

  • 2
    • 글자 크기

아래를 html로 저장하여 메소드 테스트 및 응답 헤더를 확인 가능하다.


<div id="optdiv">응답에 Allow 헤더가 있으면 출력됨</div>

<script>

var data = null;


var xhr = new XMLHttpRequest();

xhr.withCredentials = true;


xhr.addEventListener("readystatechange", function () {

  if (this.readyState === 4) {

document.getElementById("optdiv").innerHTML=this.getResponseHeader("Allow");

    console.log(this.responseText);

  }

});


xhr.open("OPTIONS", "https://www.xxx.co.kr/");

xhr.setRequestHeader("save-data", "on");

xhr.setRequestHeader("upgrade-insecure-requests", "1");

xhr.setRequestHeader("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36");

xhr.setRequestHeader("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8");

xhr.setRequestHeader("accept-encoding", "gzip, deflate, br");

xhr.setRequestHeader("accept-language", "ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7");

xhr.setRequestHeader("cache-control", "no-cache");

xhr.setRequestHeader("postman-token", "e90f3904-3224-dfbd-58b1-a97db2e18254");


xhr.send(data);

</script>


ie.png

cr.png

lispro06 (비회원)
  • 2
    • 글자 크기
[NCP] 네이버 클라우드 플랫폼에 XE3 설치 (by suritam9) [IIS] OS 업그레이드에 의한 에러 (by lispro06)

댓글 달기

첨부 (2)
ie.png
25.1KB / Download 86
cr.png
15.8KB / Download 50
위로