How to use the setRequestHeader function from sinon

Find comprehensive JavaScript sinon.setRequestHeader code examples handpicked from public code repositorys.

0
1
2
3
4
5
6
7
8
9

function registerHost(xhr, hostname, console) {
  // Only register if it's a local host.
  if (hostname.includes('FOO')) {
    xhr.open("POST", 'BAR', false);
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.onreadystatechange = function () {
      debugger;
      if (xhr.readyState === 4) {
        if (xhr.status === '200') {
fork icon0
star icon0
watch icon3