github unkn0wn-root/resterm v1.10.1

2 hours ago

v1.10.1

This patch changes how a named command auth is defined. In 1.10.0, a word after @auth <scope file|global> file command became the definition's name, so a request file written for 1.9.1 could lose its default auth without an error, like @auth file command gh. A definition is now named with name=.

If you have not updated yet, see the 1.10.0 release notes for cmd=, named command auth, errors for options with spaces around =, and the Headers tab.

Named definitions use name=

# @auth global command name=gh cmd="gh auth token"

### User
# @auth use=gh
GET https://api.github.com/user
  • name= can go anywhere on the line.
  • Only command definitions on @auth file and @auth global lines take a name. A request line with name= is an error.

In 1.9.1, a word after command was ignored, so this line was the default for every request in the workspace:

# @auth global command gh argv=["gh","auth","token"]

In 1.10.0, gh became the name of the definition. Named definitions are not inherited, so requests that relied on the line were sent without auth. Now the line is an error:

error[parse]: @auth expects key=value options but got "gh". Write name=gh to name a definition
--> defs.http:1:3
     |
   1 | # @auth global command gh argv=["gh","auth","token"]
     |   ^

Requests that take their auth from the line fail with the same error instead of being sent:

error[auth]: @auth expects key=value options but got "gh". Write name=gh to name a definition (/work/api/defs.http:1)

To fix the line, do one of these:

  • Remove the word to keep the line as the default, as it was in 1.9.1.
  • Write name=gh to make it a named definition, and add # @auth use=gh to each request that needs the token.

Completion

  • @auth suggestions follow the line. After @auth file, only auth kinds are offered. After command, only command options. After use=gh, only header, scheme, and timeout.
  • On a file or global line, choosing command leaves the options open and suggests name= first. On a request line it still inserts cmd="gh auth token".
  • use= suggests definitions from every file Resterm scans. In 1.10.0 it only suggested names from the open file. The same applies to @apply use=, @ssh use=, and @k8s use=.
  • A global definition in a subdirectory is suggested only when Resterm runs with -R, the same as when a request runs.

Changed

These changes may affect existing request files:

  • A word after @auth file command or @auth global command is an error. Write name=<some_auth_name> for a named definition, or remove the word.
  • A definition written for 1.10.0, such as @auth global command gh cmd="gh auth token", needs name=gh. Until then, the line reports the error above, and requests with @auth use=gh fail with @auth use="gh" not found.

Don't miss a new resterm release

NewReleases is sending notifications on new releases.