Skip to content

fix: correct curl invocation to use -X POST instead of positional POST#9

Open
cbarber wants to merge 1 commit into
lowitea:masterfrom
cbarber:fix/vim-system-heartbeat
Open

fix: correct curl invocation to use -X POST instead of positional POST#9
cbarber wants to merge 1 commit into
lowitea:masterfrom
cbarber:fix/vim-system-heartbeat

Conversation

@cbarber

@cbarber cbarber commented Mar 20, 2026

Copy link
Copy Markdown
curl treats { "POST", url, ... } as two positional URL arguments, making a GET request to http://POST before the real request. This causes an ~8 second stall on every heartbeat interval. Use -X POST to pass the HTTP method correctly.

Authored By: opencode (anthropic/claude-sonnet-4-6)
Reviewed By: Craig Barber (craigb@mojotech.com)

Fixes: #6

In-place config fix:

{
  "lowitea/aw-watcher.nvim",
  opts = {
    aw_server = {
      host = "127.0.0.1",
      port = 5600,
    },
  },
  config = function(_, opts)
    local aw = require("aw_watcher")
    aw.setup(opts)
    local client = aw.__private.aw
    client.__post = function(self, url, data)
      local body = vim.fn.json_encode(data)
      local args = { "-X", "POST", url, "-H", "Content-Type: application/json", "--data-raw", body }
      local handle
      handle = vim.loop.spawn("curl", { args = args, verbatim = false }, function(code)
        self.connected = code == 0
        if handle and not handle:is_closing() then handle:close() end
      end)
    end
  end,
}

curl treats { "POST", url, ... } as two positional URL arguments, making a GET request to http://POST before the real request. This causes an ~8 second stall on every heartbeat interval. Use -X POST to pass the HTTP method correctly.

Authored By: opencode (anthropic/claude-sonnet-4-6)
Reviewed By: Craig Barber (craigb@mojotech.com)
@ashleyghooper

ashleyghooper commented Jun 6, 2026

Copy link
Copy Markdown

Oops, I've duplicated the fix in my own PR (along with some bugs in the connection logic that are admittedly edge cases, but affecting me) - hadn't seen yours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Plugin blocks editor shortly after opening file

2 participants