GithubHelp home page GithubHelp logo

Comments (9)

morsdyce avatar morsdyce commented on September 6, 2024 1

Hi @spacedragon

The problem was that the fetch implementation wasn't sending the real FormData object to the server causing the server to recieve a string of "[Object object]".
This is now fixed along with a new test case that checks this functionality keeps working.

Will appreciate if you could try it out and see if it fixed your version by installing xhook with the latest commit hash: 93879b7

If you are using npm it should look like this in your package.json:

{
  "dependencies": {
    "xhook": "jpillora/xhook#93879b7"
  }
}

from xhook.

spacedragon avatar spacedragon commented on September 6, 2024

close since nobody care.

from xhook.

morsdyce avatar morsdyce commented on September 6, 2024

Hi @spacedragon,
There is no reason to get upset, you have to remember that we are people who are working on open source on our free time and don't always have time to reply because of "life".

I have just came back from a 1 month vacation, where I had no access to a computer so it's really not that we don't care about your issue but we might be just busy.

Now let's talk about the issue, you say that form data is missing from fetch, how do you know it's missing? Did you check it on the request or in the chrome dev tools?

Can you post a small example where this isn't working or post more data on how you tested it and which hooks and operations in those hooks you used so we can further debug it?

Please note that if you found out the form data is missing using the Chrome devtools, it is a bug in Google Chrome which I opened an issue for and should be fixed hopefully in the near future.

Here is the bug report if you wish to track it and see when it's fixed:
https://bugs.chromium.org/p/chromium/issues/detail?id=698209

Thanks for reporting the bug and helping us improve!

from xhook.

morsdyce avatar morsdyce commented on September 6, 2024

Hi @spacedragon

Unfortunately I'm not able to reproduce this issue so unless you can provide more info or a failing examples I'll have to close this issue.

Please let me know if this is still relevant so we can try to resolve this issue.

Thanks

from xhook.

spacedragon avatar spacedragon commented on September 6, 2024

try the following code;

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>

<form>
  <input type="text" id="username" name="username">
  <input type="password" id="password" name="password">
  <button id="submit" type="button">submit</button>
</form>

<pre id="two"></pre>

<!--<script src="./xhook.js"></script>-->
<script type="text/javascript">
  /*xhook.after(function (request, response) {
    console.log(request, response)
  });*/

  document.getElementById("submit").addEventListener("click", function () {
    var username = document.getElementById("username").value;
    var password = document.getElementById("password").value;
    const data = new FormData();
    data.append('username', username);
    data.append('password', password);
    console.log("submitting data,", data);
    fetch(`authenticate/`, {
      method: 'POST',
      credentials: 'same-origin',
      body: data
    });
  });


</script>
</body>
</html>
  1. without use xhook (we have payload)
    image

  2. enable xhook
    image

  3. I don't think it's relevant to chrome dev tools, since we found this problem because of our servers can't receive any valid request.

from xhook.

morsdyce avatar morsdyce commented on September 6, 2024

Ok, I am able to reproduce the issue. It looks like the request parameters turn in [Object object] instead of the correct payload.

I do want to mention though that testing this using the chrome dev tools currently isn't possible because of the bug I mentioned which was confirmed by the chromium team.

I reproduced the issue with Firefox and will start looking into it

from xhook.

morsdyce avatar morsdyce commented on September 6, 2024

Fixed in 1.4.5

from xhook.

Mingling94 avatar Mingling94 commented on September 6, 2024

I'm finding this issue when using 1.4.5 and 1.4.9. It may be an environmental thing or something specific to my package code, but it's the same symptom of the body FormData getting wiped out and showing [Object object] instead. It's odd that I would find this issue in later revisions. I've confirmed that the xhook node_module folder I have is actually built with 1.4.9 and contains code from 93879b7

The weirdest part is that this is happening for me despite using the native window fetch by capturing it from xhook.fetch

from xhook.

Mingling94 avatar Mingling94 commented on September 6, 2024

Just verifying, I'm still encountering this.

from xhook.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.