Skip to content

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

Open
cbarber wants to merge 1 commit intolowitea: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 intolowitea:masterfrom
cbarber:fix/vim-system-heartbeat

Conversation

@cbarber
Copy link
Copy Markdown

@cbarber cbarber commented Mar 20, 2026

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)
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

1 participant