question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How can I return the body?

See original GitHub issue

I would like the body from a website from a function returnen. Example:

var ch = getChangelog('http://xxxxxxxx.com');
console.log(ch);


function getChangelog(url){
 return rp(url).then(function(body){
})
}

I hope you understand what I would like. Who knows how I can implement this, please with code example.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
analog-nicocommented, Jul 21, 2017

ch is a promise in your case. At some other point in your code you can do:

ch.then(function (body) {
    // Process the body here
});

If you want ch to be the body object itself you need to use advanced techniques like ES6 generator functions or ES7 async/await.

0reactions
analog-nicocommented, Jul 21, 2017

You are welcome.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is your returns policy? - The Body Shop
Return to any The Body Shop location in the country of purchase with the original receipt or packing slip. Refunds are based on...
Read more >
Tennis Tips: How To Return The Body Serve
Serving into the body is a smart strategy that's often overlooked by most tennis players ... Another key, if you want to learn...
Read more >
Returning Home to Your Body: How to Reconnect and Care ...
How to Return Home to Your Body · 1. Create a body routine. · 2. Destress. · 3. Sleep more. · 4. Nourish...
Read more >
Returning "Body" Serves Rule | RETURN TIPS - YouTube
Returning " Body " Serves Rule | RETURN TIPS. Watch later. Share. Copy link. Info. Shopping. Tap to unmute. If playback doesn't begin...
Read more >
What is your return policy? - Bath & Body Works
Return anything, anytime for any reason. 100% Guaranteed. If at any time you're not completely satisfied with the quality of our products, you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found