Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. const fetch = require('node-fetch');
  2. const querystring = require('querystring');
  3.  
  4. const mydata = { one: "test1", two: "test2" };
  5. const params = {
  6. method: 'POST',
  7. body: querystring.stringify(mydata),
  8. headers: {
  9. 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
  10. 'APIKEY': '123456'
  11. }
  12. };
  13. const response = await fetch(url, params);
  14. const jsonData = await response.json();
  15. console.log(jsonData);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement