Huachao / vscode-restclient

REST Client Extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=humao.rest-client
MIT License
5.08k stars 423 forks source link

Multi-part requests: user should be able to set content-type for each part in a multi-part request. #1245

Closed ash-eng-spin closed 1 month ago

ash-eng-spin commented 4 months ago

When setting up a multipart request, Thunder Client 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.

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

Form Fields: user should be able to set because this could application/json, application/xml, text/plain, blank or many other things. Files: user should be able to set because this could be blank, application/pdf, application/octet-stream, application/vnd.ms-excel, text/csv or many other things.

Example: Multipart Form Data: PDF file content-type automatically set. 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. Thunder Client 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 Thunder Client.

image

Versions

ThunderClient v.2.17.8 Visual Studio Code 1.86.2 OS: Windows_NYx64 10.0.22621

Steps to reproduce 1

  1. Create POST request
  2. Go to Body > Form > Form Fields
  3. Enter field name and value <---User cannot change content-type of the file

Steps to reproduce 2

  1. Create POST request
  2. Go to Body > Form
  3. Select Files check box
  4. Go to Files section
  5. Enter field name and value <---User cannot change content-type of the file

For reference this is how it works in Postman: image

baojd42 commented 4 months ago

It seems like you are having problems with thunder client, however this is REST client. Here you go https://github.com/rangav/thunder-client-support I am also thinking about switching to thunder client, as it is way more actively maintained.

ash-eng-spin commented 4 months ago

Thank for you pointing this out. I will close this but first could you answer a quick question. Does this Rest Client only work on VS Code web version?

baojd42 commented 4 months ago

Not just web version. I am using this extension in a desktop version of VS.

s-prakashs commented 1 month ago

Thank for you pointing this out. I will close this but first could you answer a quick question. Does this Rest Client only work on VS Code web version?

I think you have to close this ticket , right @ash-eng-spin ?

ash-eng-spin commented 1 month ago

yes