advanced-rest-client / arc-electron

Advanced REST Client - Desktop application
Other
1.41k stars 224 forks source link

Multipart form data - unable to set content-type for file part. Also uploads files/content-type inconsistently. #516

Closed ash-eng-spin closed 5 months ago

ash-eng-spin commented 8 months ago

When setting up a multipart request, ARC automatically selects the content-type of the file part. The auto-assigned content-type is not always the desired content-type of the API spec, therefore our request will always result in a 400 Bad Request, because the content-type is wrong.

Also, in the case of csv files, the content-type is set differently on different PCs.

Please allow a way for the user to set the content type for a multi-part request part. File or text

Example 1: Multipart Form Data: CSV file content-type automatically set, inconsistent on different PCs. No manual way for user to set content-type for a file. Why is this a problem: API spec for "file" wants "text/csv" for the content-type. ARC automatically sets the content-type to "application/vnd.ms-excel" on some PCs, uploads as "text/csv" on others. No way to manually set the content-type. Results in 400 bad request because content-type does not match API spec and there is no way to change in ARC.

PC desc OS MS Office installed? ARC generated content-type for CSV file desired content type for CSV file
PC1 VM Windows Server 2016 Standard yes application/vnd.ms-excel text/csv
PC2 VM Windows Server 2016 Standard yes application/vnd.ms-excel text/csv
PC3 Windows 11 Pro yes application/vnd.ms-excel text/csv
PC4 Windows 11 Home no text/csv text/csv
PC5 Windows 11 Pro no text/csv text/csv
PC6 MacOS yes text/csv text/csv

msexcel csv

Example 2: Multipart Form Data: PDF file content-type automatically set, consistent on different PCs. No manual way for user to set content-type for a file. Why is this a problem: API spec for the pdf file wants "application/octet-stream" for the content-type. ARC automatically sets the content-type to "application/pdf". No way to manually set the content-type. Results in 400 bad request because content-type does not match API spec and there is no way to change in ARC.

PC desc OS ARC generated content-type for PDF file desired content type for PDF file
PC1 VM Windows Server 2016 Standard application/pdf application/octet-stream
PC2 VM Windows Server 2016 Standard application/pdf application/octet-stream
PC3 Windows 11 Pro application/pdf application/octet-stream
PC4 Windows 11 Home application/pdf application/octet-stream

image a.pdf sampleData.csv

Versions

App: 17.0.9

Steps to reproduce

  1. Create POST request
  2. set body to "Multipart form data"
  3. click "Add File Part"
  4. Upload a file. <---User cannot change content-type of the file
ash-eng-spin commented 8 months ago

updated 10 Jan 2024 to include a 5th & 6th PC on the "text/csv" vs "application/vnd.ms-excel" issue

KDCarey commented 8 months ago

FYI - We are seeing this problem as well. How can we escalate this issue to get a resolution?

stale[bot] commented 5 months ago

This issue has been automatically marked as stale because it has not had recent activity and is not currently prioritized. It will be closed in a week if no further activity occurs :)

ash-eng-spin commented 5 months ago

Don't mark as stale. This is a show stopper and can't use this product.

stale[bot] commented 5 months ago

If you still think this issue is relevant, please ping a maintainer or leave a comment!

ash-eng-spin commented 5 months ago

yes this is still an issue. We can't use this product because we can't test all of our APIs on it.