tutorialsClient is the outbound client, replaceable in tests. A dedicated client with its own timeout; a nil Transport is http.DefaultTransport.
()
| 92 | // tutorialsClient is the outbound client, replaceable in tests. A dedicated |
| 93 | // client with its own timeout; a nil Transport is http.DefaultTransport. |
| 94 | func (s *Server) tutorialsClient() *http.Client { |
| 95 | if s.tutorialsHTTP != nil { |
| 96 | return s.tutorialsHTTP |
| 97 | } |
| 98 | return &http.Client{Timeout: tutorialsFetchTimeout} |
| 99 | } |
| 100 | |
| 101 | func (s *Server) fetchTutorialBytes(ctx context.Context, url string, limit int64) ([]byte, string, error) { |
| 102 | ctx, cancel := context.WithTimeout(ctx, tutorialsFetchTimeout) |