Fix client side caching issues for Global Search count

Summary

When a user performs a search, we would send multiple search/count requests for each of the search scopes, which could be very expensive. In order to improve the search/count request performance, we implemented caching logic to cache the count results on the client side with 1-minute expiration.

However, @dgruzd recently found out it's not working, and he pointed out it's because the code change related to supporting HTTP 1.0 compatibility. Now, we need to fix this.

Steps to reproduce

  • Go to gitlab.com/search and search with any term
  • Open browser console and check the time spent on search/count requests

What is the current bug behavior?

There's no much different between the time spent on fetching the counts for the first time and subsequent requests

What is the expected correct behavior?

If there were other count requests within 1 minute, we would see much fast speed because of the caching

Relevant logs and/or screenshots

Possible fixes

Re-enable the caching logic for count requests. Please note, we also found that search autocomplete requests could also benefit from the same mechanism and we can apply the same logic to it as well.