github unkn0wn-root/resterm v1.10.2

3 hours ago

v1.10.2

Resterm now picks the file type itself and opens only reconized types.

If you are on 1.9.x

  • 1.10.0 adds cmd= for command auth and named command auth with use=. Options with spaces around = and unknown @auth command options are now errors. The Headers tab has a one-line summary and shows each repeated header on its own line.
  • 1.10.1 names a command auth definition with name=, as in # @auth global command name=gh cmd="gh auth token". A plain word after command is now an error, because in 1.10.0 it could turn off auth without an error.

Open in external app

In previous versions, the extension came from the file name the server sent or the URL. A body sent with filename="setup.exe" was written as resterm-2849.exe and handed to the default app. On Windows, this could e.g., run a program sent by the server. HTML and SVG bodies opened in the browser, where their scripts could run.

Now the extension always comes from the type. This body opens as invoice.pdf:

Content-Type: application/pdf
Content-Disposition: attachment; filename="invoice.exe"
  • Resterm finds the type from the Content-Type header, then the file name the server sent, then the body itself.
  • Only these types open: images, PDF, plain text, JSON, YAML, CSV, audio, video, zip and gzip archives, and Office files without macros (.docx, .xlsx, .pptx).
  • HTML, SVG, XML, and Markdown open as .txt, so scripts inside them cannot run.
  • When a type is not known, nothing opens and the status bar shows Can't pick a safe app for this body. Save it with g Shift+S.

Opened files:

  • Files keep the server's name, so the TUI shows invoice.pdf instead of resterm-2849.pdf.
  • Files go to a private temp folder that Resterm deletes when it exits. In 1.10.1, they stayed in the system temp folder.
  • Resterm waits for the opener, so it no longer leaves any processes behind. If the opener fails right away, the status bar shows the error and points to g Shift+S (save to file).
  • The response command bar shows Open next to Save on the Pretty and Raw tabs.

Save names

The name suggested by g Shift+S also changed:

  • Common types get their usual extension. audio/mpeg saves as .mp3, and +json and +xml types such as application/problem+json save as .json and .xml.
  • A name that Windows treats as a device, such as CON, AUX, NUL, or COM1, gets a _ prefix. CON.pdf saves as _CON.pdf. Opened files get the same prefix.

Changed

  • g Shift+E no longer opens executables, Office files that can hold macros (.doc, .xls, .ppt), or bodies with no known type. Save them with g Shift+S and open them yourself.

Don't miss a new resterm release

NewReleases is sending notifications on new releases.