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
lib-cloudinfo: escape path parameters and share request code in CloudInfoClient #136
Follow-up from the review of #131. CloudInfoClient builds four requests by hand, and none of them escapes the values it puts in the URL path. A stray character in a provider or region can quietly request a different URL. The four copies of the request code have also already drifted apart. Fixing both in one place makes the client safer and easier to change.
Items
Escape path parameters.provider and region go into the URL path unescaped in getRegions, getProducts, getStoragePrices and getFamilies.
A region containing ? or # (e.g. us-east-1?x) makes URI.create read the rest as a query or fragment, so a different URL is requested.
A space throws IllegalArgumentException, which gets wrapped without a status.
Percent-encode each path segment (or reject invalid values up front).
Share the request code. Those four methods repeat the same steps: build, send, check the status, decode, wrap the exception. Timeouts, logging and error handling already differ between them (30s vs 60s). A private helper such as HttpResponse<String> get(String url, Duration timeout, String what), reusing apiError, would remove the duplication.
Activity
[release] fix(lib-cloudinfo): escape provider and region path segment…