Skip to content

fix(server): add GET /observations endpoint for plugin compatibility#336

Open
Wild-sergunys wants to merge 1 commit intoGentleman-Programming:mainfrom
Wild-sergunys:fix/288-get-observations-endpoint
Open

fix(server): add GET /observations endpoint for plugin compatibility#336
Wild-sergunys wants to merge 1 commit intoGentleman-Programming:mainfrom
Wild-sergunys:fix/288-get-observations-endpoint

Conversation

@Wild-sergunys
Copy link
Copy Markdown

What

Added GET /observations endpoint that reuses handleRecentObservations handler.

Why

The save-nudge plugin sends GET /observations?project=...&limit=1&sort=created_at:desc
but the server only had POST /observations, returning 405 Method Not Allowed.
The plugin silently failed because curl -sf suppresses error output.

How

  • Registered new route GET /observations pointing to handleRecentObservations
  • Updated DOCS.md with the new endpoint
  • Added test coverage

Testing

  • main: curl -s -w "\nHTTP_CODE: %{http_code}\n" "..." -> 405 Method Not Allowed
  • This branch: same curl -> 200 OK
  • All existing server tests pass
  • New test TestHandleGetObservationsWithSort passes

Closes #288

Added GET /observations route that reuses handleRecentObservations handler.
Updated DOCS.md with the new endpoint.
Added test coverage for the new route with and without sort parameter.

Closes Gentleman-Programming#288
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.

Plugin save-nudge silently broken: GET /observations returns 405, hook never warns

1 participant