Skip to content

internal/gitserver: Improvement to RepoInfo method

Administrator requested to merge ig/gitserver-client-repoinfo into main

Created by: indradhanush

This PR makes two functional improvements to the RepoInfo client method and a semantic one.

The functional improvements are:

  1. Limit length of map to max number of shards
  2. Do not hide response body for failed HTTP reqs

The semantic improvement is:

  1. 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.

image

UI should now look like this:

image

VS current behaviour without this PR:

image

Note for time travellers

Without strings.TrimSpace

image

With strings.TrimSpace

image

Merge request reports

Loading