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

Get an empty body or zero length rawBody in some case #1251

Closed
2 tasks done
fengkx opened this issue May 12, 2020 · 3 comments
Closed
2 tasks done

Get an empty body or zero length rawBody in some case #1251

fengkx opened this issue May 12, 2020 · 3 comments

Comments

@fengkx
Copy link
Contributor

fengkx commented May 12, 2020

Describe the bug

  • Node.js version: Nodejs.14.1 & Nodejs.12.16.3
  • OS & version: Linux 5.5.19-1-MANJARO

Actual behavior

Get an empty body or zero length body

Expected behavior

Get the actual body

Code to reproduce

https://runkit.com/embed/tyzrkbthl3bs

Checklist

  • I have tried my code with the latest version of Node.js and Got.
  • I have read the documentation.
@Giotino
Copy link
Collaborator

Giotino commented May 12, 2020

Related to #1234

Got 11 transform http://www.newsmth.net/rss.php?mPicture into http://www.newsmth.net/rss.php?mPicture= which body is empty

@Giotino
Copy link
Collaborator

Giotino commented May 12, 2020

As suggested by @cookch10 this is a temporary workaround

const url = new URL('http://www.newsmth.net/rss.php?mPicture');
const _search = url.search;
Object.defineProperty(url, 'search', {
  get() {
    return _search;
  },
  set() {
  }
});

;(async () => {
    const resp = await got.get(url);
    console.log(resp);
})()

@szmarczak
Copy link
Collaborator

Duplicate of #1234

@szmarczak szmarczak marked this as a duplicate of #1234 May 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants