Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making POST requests via Node.js returns 'empty' response #261

Open
jschof1 opened this issue Jun 15, 2022 · 0 comments
Open

Making POST requests via Node.js returns 'empty' response #261

jschof1 opened this issue Jun 15, 2022 · 0 comments

Comments

@jschof1
Copy link

jschof1 commented Jun 15, 2022

When I make a post request using JavaScript the response returns an empty string. I can only seem to get the correct response via a cUrl request.


var url = "http://csvlint.io/package.json";

var xhr = new XMLHttpRequest();
xhr.open("POST", url);

xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

xhr.onreadystatechange = function () {
  if (xhr.readyState === 4) {
      xhr.responseText
      
  }
};

var data = "urls[]=http://theodi.github.io/hot-drinks/hot-drinks.csv";

xhr.send(data);
let res = xhr.responseText
console.log(res)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant