usebruno / bruno

Opensource IDE For Exploring and Testing Api's (lightweight alternative to postman/insomnia)
https://www.usebruno.com/
MIT License
27.37k stars 1.26k forks source link

upload image #3343

Open Imran2805 opened 3 weeks ago

Imran2805 commented 3 weeks ago

When running the 'upload_logo' request from the folder, I encounter an error. However, the request works fine when run individually.

I expected the 'upload logo' request should work the same way when run from the folder as it does individually.

The error message I receive when running the request from the folder is "TypeError: Cannot read properties of undefined (reading 'value')"

Screenshots for more context:

When running the request individually it works fine.

cropped

But if I run the request by running from the folder, I get an error.

cropped2

This is the error I got.

Screenshot (19)

This is what I set in the body of the request.

Screenshot (20)

I'm not sure whether this issue is due to a bug or if I made an error in my setup. Any guidance or suggestions would be greatly appreciated.

Pragadesh-45 commented 3 weeks ago

Hey @Imran2805,

Thank you for reporting this bug. However, I don't think it's caused by Bruno. I noticed that you've added a value (the image, in this case) without providing a key. Could you please add a key for the value and try again?

Alternatively, there might be an issue with your script, but this doesn't appear to be a bug with Bruno.

PS: If this resolves your issue, kindly close the ticket.

Pragadesh-45 commented 3 weeks ago

This might help with testing multipart form image upload:

Sample .bru:

meta {
  name: abc
  type: http
  seq: 7
}

post {
  url: https://api.upload.io/v1/files/form_data
  body: multipartForm
  auth: bearer
}

auth:bearer {
  token: free
}

body:multipart-form {
  fileKey: @file(C:\Users\codex\Downloads\wallpaper.png)
}
Imran2805 commented 3 weeks ago

This might help with testing multipart form image upload:

Sample .bru:

meta {
  name: abc
  type: http
  seq: 7
}

post {
  url: https://api.upload.io/v1/files/form_data
  body: multipartForm
  auth: bearer
}

auth:bearer {
  token: free
}

body:multipart-form {
  fileKey: @file(C:\Users\codex\Downloads\wallpaper.png)
}

I've made some changes to match exactly like the sample but still show the same error. I did add some tests in the test section, for example checking the status code, etc.

However, when the tests section of the request is empty, I can run the request from the folder perfectly fine with no error and getting the '200 OK' status, but just without any tests to validate the responses.

Pragadesh-45 commented 3 weeks ago

Hey @Imran2805,

I think I understand your issue better now. Since you have tests with errors, your responses are also breaking. I was able to reproduce that as well. We will update a fix for this.

PS: For now, to get your request running, try fixing your test script first.

anusree-bruno commented 5 days ago

Hi @Imran2805,

Would you be able to share the collection that’s causing this issue? It would help us better understand the exact problem you’re encountering. Please feel free to send it over after removing any sensitive information.

Thanks!