foss42 / apidash

API Dash is a beautiful open-source cross-platform API Client built using Flutter which can help you easily create & customize your API requests, visually inspect responses and generate API integration code. A lightweight alternative to postman/insomnia.
https://apidash.dev
Apache License 2.0
1.43k stars 269 forks source link

Support File as Request Body #352

Open animator opened 5 months ago

animator commented 5 months ago

Tell us about the task you want to perform and are unable to do so because the feature is not available Currently API Dash supports text, json, multipart formdata as request body. Support should also be provided to attach just a single file. The contents of the file is sent as bytes and the content-type is application/octet-stream

Example API use case - Send an image in request body and obtain its base64 string form as response.

AcousticDeveloper commented 5 months ago

Shall we add one more tab like section named File Upload beside the existing three with a drag and drop interface or for the initial setup, the existing select file is preferred?

image

Tanish2002 commented 5 months ago

@animator would this include rewriting all codegens and their corresponding tests as well?

Also, I believe I would have to add a new state variable to class RequestModel to store the file name, I can't simply use requestBody since it's shared by json and text type requests and when switching between them, it would conflict.

alainjr10 commented 5 months ago

Has anyone noticed file picker not working on linux? I don't know if i should raise a new issue or maybe my environment isn't properly configured. The pick file method returns null

Tanish2002 commented 5 months ago

Has anyone noticed file picker not working on linux? I don't know if i should raise a new issue or maybe my environment isn't properly configured. The pick file method returns null

@alainjr10 Yeah this isn't documented but on linux you need zenity installed to make it work correctly.

@animator I believe the mpv and zenity dependency should be documented for linux developers

Edit: Link to the package on repology: https://repology.org/project/zenity/versions

Edit 2: it needs one of the following qarma, kdialog, zenity: source: https://github.com/miguelpruivo/flutter_file_picker/blob/04e32daa8180e4d93a96c1d0ffba9d61feb25b10/lib/src/linux/file_picker_linux.dart#L108

alainjr10 commented 5 months ago

Has anyone noticed file picker not working on linux? I don't know if i should raise a new issue or maybe my environment isn't properly configured. The pick file method returns null

@alainjr10 Yeah this isn't documented but on linux you need zenity installed to make it work correctly.

@animator I believe the mpv and zenity dependency should be documented for linux developers

Edit: Link to the package on repology: https://repology.org/project/zenity/versions

Edit 2: it needs one of the following qarma, kdialog, zenity: source: https://github.com/miguelpruivo/flutter_file_picker/blob/04e32daa8180e4d93a96c1d0ffba9d61feb25b10/lib/src/linux/file_picker_linux.dart#L108

Thanks a lot @Tanish2002 . I been stuck on this issue since yesterday. I'll try it and give you feedback.

Tanish2002 commented 5 months ago

FWIW, I've opened a PR to potentially fix this issue #357