Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: Save Body As File #183

Closed
kristopherbullinger opened this issue Apr 26, 2024 · 1 comment · Fixed by #192
Closed

feature request: Save Body As File #183

kristopherbullinger opened this issue Apr 26, 2024 · 1 comment · Fixed by #192
Labels
feature New behavior to enable things that were previously not possible

Comments

@kristopherbullinger
Copy link

Motivation:
Users may benefit from being able to open non-human readable response bodies with other programs, such as an image viewer or database.
Users may benefit from being able to view human-readable response bodies in text editors with syntax highlighting and other modern features enabled.

Feature summary:
I propose adding an option on the Response Body panel which prompts the user to specify a file name, populated by default with the final segment of the request path, and saves the body into a file with that name upon confirmation by the user.

Proposed workflow:

  1. user makes request to https://myapi.com/cat.png
  2. body appears as byte sequence in the Response Body panel
  3. user navigates to the Result Body panel, presses a button to initiate the "save locally" flow
  4. a modal appears: "Save Body To File? Filename: cat.png"
  5. the user may edit the filename
  6. press ESC to cancel or Enter to save the file

Thank you for your consideration.

@LucasPickering LucasPickering added the feature New behavior to enable things that were previously not possible label Apr 26, 2024
@LucasPickering
Copy link
Owner

I've started working on this, but due to the suboptimal architecture of the UI it's going to take a bit of work. Some considerations for behavior:

  • Should it populate a default path in the text box? We could guess at the file name in a few ways:
    • Content-Disposition header
    • Fall back to guessing extension from Content-Type header, with some placeholder for the basename
    • Leave it empty for unknown content types
  • If the path contains directories that don't yet exist, should it create them?
  • What happens if the file already exists? Overwrite?
    • Ideally we'd show a prompt that asks if you want to overwrite. UI shouldn't be too tricky for that

If anyone has input please let me know

LucasPickering added a commit that referenced this issue May 1, 2024
LucasPickering added a commit that referenced this issue May 2, 2024
LucasPickering added a commit that referenced this issue May 3, 2024
LucasPickering added a commit that referenced this issue May 3, 2024
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue May 6, 2024
[1.1.0] - 2024-05-05

Added
- Add `section` field to `!request` chain values, to allow chaining response headers rather than body ([#184](LucasPickering/slumber#184))
- Add action to save response body to file ([#183](LucasPickering/slumber#183))
- Add `theme` field to the config, to configure colors ([#193](LucasPickering/slumber#193))
  - [See docs](https://slumber.lucaspickering.me/book/api/configuration/theme.html) for more info
- Add `stdin` option to command chains ([#190](LucasPickering/slumber#190))

Changed
- Reduce UI latency under certain scenarios
  - Previously some actions would feel laggy because of an inherent 250ms delay in processing some events
- Search parent directories for collection file ([#194](LucasPickering/slumber#194))
- Use thicker borders for selected pane and modals
- Change default TUI colors to blue and yellow

Fixed
- Fix Slumber going into zombie mode and CPU spiking to 100% under certain closure scenarios ([#136](LucasPickering/slumber#136))
- Fix historical request/response no loading on first render ([#199](LucasPickering/slumber#199))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New behavior to enable things that were previously not possible
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants