Making HTTP Requests using Chrome Developer tools

后端 未结 12 1537
小鲜肉
小鲜肉 2020-12-04 04:28

Is there a way to make an HTTP request using the Chrome Developer tools without using a plugin like POSTER?

12条回答
  •  时光取名叫无心
    2020-12-04 05:09

    To GET requests with headers, use this format.

       fetch('http://example.com', {
          method: 'GET',
          headers: new Headers({
                   'Content-Type': 'application/json',
                   'someheader': 'headervalue'
                   })
        })
        .then(res => res.json())
        .then(console.log)
    

提交回复
热议问题