internal/gitserver: Improvement to RepoInfo method
Created by: indradhanush
This PR makes two functional improvements to the RepoInfo client method and a semantic one.
The functional improvements are:
- Limit length of map to max number of shards
- Do not hide response body for failed HTTP reqs
The semantic improvement is:
- Add comment and rename shard -> repoInfoReq
Note to reviewers
It's recommended to look at each commit sequentially to view the changes in an isolated way. This should make it easier to understand the changes in this PR vs looking at the entire diff at the same time.
The pain point with no response body for non 200 errors was first observer in this customer issue which also led to the other improvements as I was reading and understanding this code.
Test plan
- Added tests.
- Did end to end UI testing. Applied the following diff to the code to simulate 500 HTTP response.
UI should now look like this:
VS current behaviour without this PR:
Note for time travellers
Without strings.TrimSpace
With strings.TrimSpace