elements icon indicating copy to clipboard operation
elements copied to clipboard

Form data request are going without fields

Open Yashaswi-1998 opened this issue 1 year ago • 0 comments

There is an Upload API in this openApi spec which uses multipart/form-data to send the request. On using the stoplight demo project when I try to send a request through this API no fields are being attached in the request payload which can be clearly seen in the network tab under inspect panel of the browser. This is the link to the stoplight demo https://elements-demo.stoplight.io/?spec=https://raw.githubusercontent.com/Yashaswi-1998/OpenApi/main/Imagekit.yaml#/operations/upload-file

Context

Users are not able to use the API even after entering correct details. The API errors out, confusing the users.

Current Behavior

Currently the API errors out with below message. This is happening because fileName field is not getting attached in form data.

{
    "message": "Your request is missing fileName parameter.",
    "help": "For support kindly contact us at [email protected] ."
}

Expected Behavior

It should upload the file and give 201 status code.

Possible Workaround/Solution

NA

Steps to Reproduce

  1. Open this page https://elements-demo.stoplight.io/?spec=https://raw.githubusercontent.com/Yashaswi-1998/OpenApi/main/Imagekit.yaml#/operations/upload-file
  2. Fill the try it section(attached screenshot) with below details Screenshot 2024-07-30 at 12 56 47 PM

Authorization => Basic cHJpdmF0ZV9VUXZwU2tRVGRheGlYcXNaZStOaGd0by9iZ3c9Og== file* =>https://media.istockphoto.com/id/1127245421/photo/woman-hands-praying-for-blessing-from-god-on-sunset-background.webp?b=1&s=170667a&w=0&k=20&c=bPoh4FbWez1Za2_DfgYY2VlZ3F6RKtx9_OF8I5ZSpXU= fileName* => demoFileName

Now after this if we will click on Send API Request it will throw below error

{
    "message": "Your request is missing fileName parameter.",
    "help": "For support kindly contact us at [email protected] ."
}

This error is occurring because when we check payload under network tab in inspect panel, it is empty Screenshot 2024-07-30 at 1 02 46 PM

Environment

Prod

  • Version used:
  • Environment name and version (e.g. Chrome 39, node.js 5.4): Chrome Version 126.0.6478.183 (Official Build) (arm64)
  • Operating System and version (desktop or mobile): MacBook laptop Macos ventura
  • Link to your environment/workspace/project: https://elements-demo.stoplight.io/?spec=https://raw.githubusercontent.com/Yashaswi-1998/OpenApi/main/Imagekit.yaml#/operations/upload-file

Yashaswi-1998 avatar Jul 30 '24 07:07 Yashaswi-1998