github unkn0wn-root/resterm v1.14.1

3 hours ago

v1.14.1

This patch fixes captures that broke when a comment had an apostrophe in it, and I've made the error clearer when response.json is read without a call.

Comments in multi-line captures

An apostrophe or a quote in a comment could stop the response.json.<field> from working in a multi-line capture:

### Get user
# @name GetUser
# @capture file user.id = (
#   # the user's id
#   response.json.id
# )
GET {{base.url}}/users/me

The ' in user's was read as the start of a string, so response.json.id was never turned into response.json().id and the capture failed:

error[script]: member on non-object
--> api.http:5:18

Quotes inside comments are now ignored, and the capture above saves the id. Quoted strings in the expression are still left as written.

The @capture warning for a double dot after json follows the same rule. It no longer fires for response.json..id inside a comment, and it now catches one in the expression even when an earlier comment has an '.

response.json outside captures

The response.json.id shorthand only works in @capture. In other directives such as @assert and @when, and inside {{= ... }}, json is a function and has to be called.

The error for this used to be member on non-object, which didn't say much. It now names the function:

### Health
# @assert response.json.ok
GET {{base.url}}/health
error[script]: member on function response.json. Call it first

Write it as response.json().ok or response.json("ok"). last.json.id gets the same hint.

The captures docs and the RestermScript docs now say where the shorthand works.

Workflow tab on light themes

The Workflow tab used colors made for dark backgrounds, so with a light theme most of it was hard to read. The summary, step list, and selected step now use the same palette as the Profile tab, which already followed the theme. Step response bodies also use the theme's syntax highlighting, like the main response pane.

This only affects themes tagged light. Dark themes look the same, except that a script error in a step's test results is now shown in the theme's error color, as it already was in the response pane.

Thanks @smxgit for fixing that!

Explain pane

In the final request section, the body used to sit right under the headers with no title of its own, so it looked like part of them:

Details
Auth: bearer
Headers
Content-Type: application/json
  {"name": "ada"}
Steps
• resolve vars

Rows are now indented under their titles, and the body has its own:

Details
  Auth: bearer
Headers
  Content-Type: application/json
Body
  {"name": "ada"}
Steps
  • resolve vars

For gRPC requests, the note saying where the message came from is shown under Body too.

Upgrading from 1.13.3 or earlier

1.14.0 changed a few things worth checking:

  • On macOS and Linux, history files are readable only by their owner (0600, and 0700 for new directories). Resterm removes group and other permissions from existing history files when it opens them.
  • resterm history backup refuses to overwrite a file that isn't a SQLite database. Previous versions deleted it.
  • resterm history compact exits with 1 when another process keeps the database from shrinking.
  • The headless Go API has breaking changes to usage errors, failure rules, and JSON field names. Read the 1.14.0 notes first if you call it from Go.

Don't miss a new resterm release

NewReleases is sending notifications on new releases.