gitlink-cli/doc/changes/client-robustness-fixes.md

1.2 KiB

Client Robustness Fixes

Summary

This change improves shared client/context behavior used by all shortcuts and raw API calls:

  • send Accept: application/json on every request
  • send Content-Type: application/json when a JSON body is present
  • decode GitLink responses whose data field is itself a JSON string into structured data
  • avoid mutating caller-provided pagination query parameters in PaginateAll
  • normalize remote URL path segments more defensively when resolving owner/repo

Why

These fixes make CLI behavior more predictable for both human users and Agents:

  • API gateways can correctly classify request and response formats.
  • JSON-string data payloads become usable structured output instead of opaque strings.
  • Pagination helpers no longer leak page/default limit mutations back to callers.
  • Repository auto-detection works better with remote URLs that include redundant slashes or trailing path separators.

Validation

git diff --check
GOPROXY=https://goproxy.cn,direct go test ./internal/client ./internal/context
go vet ./internal/client ./internal/context
GOPROXY=https://goproxy.cn,direct go test ./...
go vet ./...