You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mw: send every API call through one request path #45
Every call in internal/mw repeats the same steps: build the request, close the body, check the HTTP status, decode, check the error envelope. That's 8 copies across client.go and list.go, and they have drifted:
token, Login and Edit don't check the HTTP status, so a wiki that answers 503 with an HTML page gives a JSON parse error instead of the status. Against an httptest server returning 503 and <html>…:
Login: invalid character '<' looking for beginning of value
Edit: invalid character '<' looking for beginning of value
FetchPage: mediawiki api: 503 Service Unavailable
RevisionText: mediawiki api: 503 Service Unavailable
Edit declares its own copy of apiError's shape and formats it differently (edit error code: info vs mediawiki api error code: info).
fetchBatchOnce redeclares the page/revision structs that apiResponse already has.
Fix: one helper that does a GET or POST, checks the status, and decodes into the caller's struct while handling the error envelope, with every call using it. Add a test that a non-200 from Login and Edit reports the status.
Activity
chore: bump version to 0.5.1 (#63)