Skip to content

Feature request: return 200 instead of 202 from GET /update #1151

Description

@buddhaCode
  1. What's the feature?

This is more of a question / small correctness improvement about the GET /update endpoint's HTTP status code.

The handler forces an update run and then replies with 202 Accepted plus a plain-text body ("All records updated successfully in ...").

From reading the code, ForceUpdate looks synchronous: it sends on the force channel and blocks on forceResult, so updateNecessary (public IP fetch, DNS resolve, provider update) appears to have already completed by the time the handler writes its response:

// internal/server/update.go
errors := h.runner.ForceUpdate(h.ctx)   // appears to block until the run is done
...
w.WriteHeader(http.StatusAccepted)       // 202

202 Accepted usually means "request accepted, processing not finished yet". If the work is already done when the response is sent, wouldn't 200 OK describe it more accurately? With 202, a client polling the result may think the update is still pending.

Is the 202 intentional (maybe there's an async aspect I'm missing), or just an oversight? If you agree 200 is more correct, I'm happy to send a small PR.

  1. Extra information?

Noticed this while looking into dyndns2-client compatibility for the same endpoint (#1150).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions