Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What's the difference between the two #39

Open
daydayhappychao opened this issue Oct 18, 2017 · 5 comments
Open

What's the difference between the two #39

daydayhappychao opened this issue Oct 18, 2017 · 5 comments
Labels

Comments

@daydayhappychao
Copy link

daydayhappychao commented Oct 18, 2017

   ` 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

@gr2m gr2m added the bug label Feb 27, 2018
@gr2m
Copy link
Collaborator

gr2m commented Feb 27, 2018

can you still reproduce the issue? If so, can you provide a URL with which the error occurs? Is this in browser or in Node?

@gr2m
Copy link
Collaborator

gr2m commented Feb 27, 2018

Is this a duplicate of #45?

@daydayhappychao
Copy link
Author

I am sorry that I have just tried again, but I have not been able to repeat this issue. I will close this issue. Thank you for your reply.

@daydayhappychao
Copy link
Author

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.

@DevBrent
Copy link

DevBrent commented Aug 22, 2018

I believe this issue to be related to the known issues with node-fetch's clone() polyfill. #48 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants