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

Data corruption #4019

Closed
xHyroM opened this issue Sep 5, 2021 · 0 comments · Fixed by #4020
Closed

Data corruption #4019

xHyroM opened this issue Sep 5, 2021 · 0 comments · Fixed by #4020

Comments

@xHyroM
Copy link

xHyroM commented Sep 5, 2021

Describe the bug

The data should always be json, but in this case it's corrupted and there are invalid characters.

To Reproduce

Code snippet to reproduce, ideally that will work by pasting into something like https://npm.runkit.com/axios, a hosted solution, or a repository that illustrates the issue. If your problem is not reproducible, please file under Support or Usage Question

    let test = await axios({
      url: new URL('https://discord.com/api/v9/users/@me').toString(),
      responseType: 'json',
      responseEncoding: 'utf8',
      method: "PATCH",
      headers: {
        ...getIdentifiers(),
        "Authorization": `${x}`
      },
      data: {
        bio: date
      }
    })

   console.log(test.data)

Expected behavior

It was supposed to return json to me, as node-fetch only node-fetch uses ESM, so I can't use it and it doesn't have PATCH request support.

Environment

  • Axios Version 0.21.3
  • Adapter HTTP
  • Browser [Firefox
  • Browser Version Latest
  • Node.js Version 16.6.2
  • OS: Windows 11

Additional context/Screenshots

Add any other context about the problem here. If applicable, add screenshots to help explain.
obrázok

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

Successfully merging a pull request may close this issue.

2 participants