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

[Bug] Unable to send File in multipart form request that includes pre-request script #8240

Open
2 of 4 tasks
eboozer opened this issue Dec 9, 2024 · 4 comments
Open
2 of 4 tasks
Labels
B-bug Bug: general classification S-unverified Status: Unverified by maintainer

Comments

@eboozer
Copy link

eboozer commented Dec 9, 2024

Expected Behavior

Multipart form fields should not be affected when adding pre-request script that does not touch request body.

Actual Behavior

Multipart from-data does not include filename for a form field that includes file data.

  • If the form-data field does NOT include a name, then the field is excluded in the final request.
  • If the form-data field DOES include a name, then the field is included in the final request but it doesn't include the filename, nor any file data.
    • Note, the filename aspect is required for some APIs (like Ktor) to understand that the FormData field is actually a file, and not a normal form field.

Reproduction Steps

  1. Create new POST request
  2. Set Body to use multipart
  3. Add new form-data field for the body that includes a file
  4. Set new pre-request script
  5. Update the request's auth according to standard documentation:
insomnia.request.auth.update(
  {
    type: 'bearer',
    bearer: [
      { key: 'token', value: 'XXX' },
      { key: 'prefix', value: 'Bearer' },
    ],
  },
  'bearer'
);
  1. Send request
  2. Note that the console outputs for the request structure

Is there an existing issue for this?

Which sync method do you use?

  • Git sync.
  • Insomnia Cloud sync.
  • Local only

Additional Information

The expected behavior should continue to work as it does as if there is no pre-request script on the request. The behavior does work fine without any script, and adding the auth update should not have any affect on the request body formdata inputs.

Insomnia Version

v10.2.0

What operating system are you using?

macOS

Operating System Version

Darwin arm64 23.6.0

Installation method

Homebrew

Last Known Working Insomnia version

No response

@eboozer eboozer added B-bug Bug: general classification S-unverified Status: Unverified by maintainer labels Dec 9, 2024
@notjaywu
Copy link
Contributor

@ihexxa to take a look

@usmajeed
Copy link

also experiencing

@eboozer
Copy link
Author

eboozer commented Dec 16, 2024

Just following up on this post. I tried to be as detailed as I could, but please let me know if you have any issues recreating this issue. This seems like, at the very least, unexpected behavior, but I'm happy to test any alternative workflows if there is another way of accomplishing this. My end goal is simply to have the pre-request script set the authentication for a multi-part form request, so if there are additional steps to accomplish that, I'm happy to test them out to see if they work for my purposes.

@ihexxa
Copy link
Contributor

ihexxa commented Dec 17, 2024

Thanks @eboozer the steps are detailed, will look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-bug Bug: general classification S-unverified Status: Unverified by maintainer
Projects
None yet
Development

No branches or pull requests

4 participants