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.

What's the difference between the two

See original GitHub issue
   ` let info = await r2(url(data[i]['ename']), { headers }).text
     console.log(info) `

No output

   ` let info = await r2(url(data[i]['ename']), { headers }).response
     info = await info.text()
     console.log(info) `

The output is successful

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
Magin-CCcommented, Mar 21, 2018
const r2 = require('r2')

let page = 1
let getUrl = page => `https://www.hongxiu.com/free/all?pageNum=${page}&pageSize=10&gender=2&catId=-1&isFinish=1&isVip=1&size=-1&updT=-1&orderBy=0`

async function start() {
    try {
        let info = await r2(getUrl(page)).response
        info = await info.text()
        console.log(info)  // true response
    } catch (e) {
        console.log('error↓')
        console.log(e)
    }
}
start()

I don’t know if you can request Chinese website, I found the same mistake on this website. this is my code , it’s useful,but if i change the code like this:

async function start() {
    try {
        let info = await r2(getUrl(page)).text
        console.log(info)  //response is empty
    } catch (e) {
        console.log('error↓')
        console.log(e)
    }
}

it return empty.

0reactions
DevBrentcommented, Aug 22, 2018

I believe this issue to be related to the known issues with node-fetch’s clone() polyfill. https://github.com/mikeal/r2/issues/48#issuecomment-415166175

Read more comments on GitHub >

github_iconTop Results From Across the Web

What's the difference between the two? [closed]
1 is an expression making fun of the other person. Is there a difference between using a person and using something other than...
Read more >
What is the difference between "to" and "two"? - ProWritingAid
To means toward when used as an adverb. As a preposition, it is used to convey motion or direction between two nouns or...
Read more >
What are the differences between 'two' and 'both' in English?
The word “both” is used when comparing similarities in “two” subjects. The opposite of “both” is “neither”.
Read more >
the difference between the two | English examples in context
The difference between the two programs? The difference between the two is vast.
Read more >
To vs. Too vs. Two: Two Ways To Remember The Difference
The words to, too, and two sound exactly alike but are used in completely different ways. They are classic examples of what we...
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