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

Include buffered multipart form data request #143

Open
staizen-alexm opened this issue Aug 10, 2021 · 2 comments
Open

Include buffered multipart form data request #143

staizen-alexm opened this issue Aug 10, 2021 · 2 comments

Comments

@staizen-alexm
Copy link

Environment (please complete the following information):

  • Package version: 4.1.6
  • Node.js version: 14.16.1
  • NPM version: 6.14.12
  • Browser name and version: Chrome 92
  • Platform name and version: MacOSX

Describe the bug
browser.getRequests() give an empty request body for an intercepted multipart/form-data type request

To Reproduce
just to give an idea of the flow:

browser.url('http://foo.bar');
browser.setupInterceptor();
browser.click('#button');

**multipart formdata request happens**

browser.getRequests();

Result
See attachment and enquiryForm returned is empty.

[
  {
    url: "http://localhost:1080/sso/api/v1/sendEnquiryEmailNotification/contactUs",
    method: "POST",
    body: {
      attachment: [
        {
        },
      ],
      enquiryForm: [
        {
        },
      ],
    },
    headers: {
      accept: "REDACTED",
      authorization: "REDACTED",
    },
    response: {
      headers: {
        "content-length": "REDACTED",
        "content-type": "REDACTED",
      },
      body: "REDACTED",
      statusCode: 200,
    },
  }
]

Expected behavior
Perhaps return a buffered version of the raw request or return something close to what chrome dev tools does?

------WebKitFormBoundary0EqzZIl45dhs4UWu
Content-Disposition: form-data; name="attachment"; filename="app-pdf.pdf"
Content-Type: application/pdf


------WebKitFormBoundary0EqzZIl45dhs4UWu
Content-Disposition: form-data; name="enquiryForm"; filename="blob"
Content-Type: application/json

{"contactMode":"email","enquiryTopic":"account","message":"REDACTED"}
------WebKitFormBoundary0EqzZIl45dhs4UWu--
@staizen-alexm
Copy link
Author

i'll be happy to contribute with the patch if someone can point me on the right bits to look at. thanks!

@iamkenos
Copy link

watch 👀

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

2 participants