Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function fetchDinner(url){
- return new Promise(function(resolve, reject) {
- request({
- method: 'POST',
- uri: url,
- jar: true,
- form: {
- username: 'zeke',
- password: 'coys'
- },
- followAllRedirects: true
- }, function(error, response, html){
- if(error) {
- return reject(error);
- }
- if(response.statusCode !== 200){
- return reject(new Error('Bad status code from server'));
- }
- resolve(html);
- });
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement