Skip to content

restish api edit does not clear cache on MacOS #302

@Stratus3D

Description

@Stratus3D

First off, thank you for the excellent tool! I use this tool every day issue requests to REST APIs I use. The OpenAPI integration is wonderful!

Here is the sequence of steps to reproduce:

$ restish my-api server-info
# Response as expected

$ restish api edit
# Opens my editor and I change my-api hostname and save

$ restish my-api server-info
# Response from old hostname instead of new hostname, this is unexpected and not desired!
ERROR: Caught error: Get "https://olhost/": dial tcp: lookup oldhost on 1.1.1.1:123: no such host

Checking in ~/Library/Caches/restish/cache.json I see:

{
  "my-api": {
    "expires": "2025-10-14T08:53:32.646629-04:00"
  }
  ...
}

The expiration date is listed as a day later than when I generated this test scenario. The workaround I came up with was:

# destroy cache
$ rm ~/Library/Caches/restish/cache.json

# issue request again
$ restish my-api server-info
# Observe that it issues a request to the new hostname as expected

Should restish api edit clear cache for apis that were edited? It seems like it should.

I observe similar behavior when using restish api configure my-api and when editing ~/Library/Application Support/restish/apis.json directly.

My environment:

  • Version: restish version 0.20.0
  • Architecture: Apple M1 Pro
  • OS version: MacOS Version 15.2
  • Shell: zshell
  • Editor: vim

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions