Skip to content

Instantly share code, notes, and snippets.

@d00rman
Created November 3, 2017 10:30
Show Gist options
  • Save d00rman/1d5309cb112494b0b247884f8e552d09 to your computer and use it in GitHub Desktop.
Save d00rman/1d5309cb112494b0b247884f8e552d09 to your computer and use it in GitHub Desktop.
'use strict';
const preq = require('preq');
return preq.post({
uri: 'https://en.wikipedia.org/w/api.php',
headers: {
'content-type': 'application/json'
},
body: {
action: 'query',
prop: 'info|revisions',
titles: 'Foobar',
format: 'json',
formatversion: 2
}
})
.then((res) => {
console.log(res.status);
console.log(JSON.stringify(res.headers, null, 2));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment