|
9 | 9 | "context" |
10 | 10 | "fmt" |
11 | 11 | "strconv" |
12 | | - "strings" |
13 | 12 |
|
14 | 13 | qs "github.com/google/go-querystring/query" |
15 | 14 | ) |
@@ -317,32 +316,12 @@ func (s *SearchService) search(ctx context.Context, searchType string, parameter |
317 | 316 | if err != nil { |
318 | 317 | return nil, err |
319 | 318 | } |
320 | | - var acceptHeaders []string |
321 | | - switch searchType { |
322 | | - case "commits": |
323 | | - // Accept header for search commits preview endpoint |
324 | | - // TODO: remove custom Accept header when this API fully launches. |
325 | | - acceptHeaders = append(acceptHeaders, mediaTypeCommitSearchPreview) |
326 | | - case "topics": |
327 | | - // Accept header for search repositories based on topics preview endpoint |
328 | | - // TODO: remove custom Accept header when this API fully launches. |
329 | | - acceptHeaders = append(acceptHeaders, mediaTypeTopicsPreview) |
330 | | - case "repositories": |
331 | | - // Accept header for search repositories based on topics preview endpoint |
332 | | - // TODO: remove custom Accept header when this API fully launches. |
333 | | - acceptHeaders = append(acceptHeaders, mediaTypeTopicsPreview) |
334 | | - case "issues": |
335 | | - // Accept header for search issues based on reactions preview endpoint |
336 | | - // TODO: remove custom Accept header when this API fully launches. |
337 | | - acceptHeaders = append(acceptHeaders, mediaTypeReactionsPreview) |
338 | | - } |
339 | | - // https://docs.github.com/rest/search#search-repositories |
| 319 | + // https://docs.github.com/en/rest/search/search#text-match-metadata |
340 | 320 | // Accept header defaults to "application/vnd.github.v3+json" |
341 | 321 | // We change it here to fetch back text-match metadata |
342 | 322 | if opts != nil && opts.TextMatch { |
343 | | - acceptHeaders = append(acceptHeaders, "application/vnd.github.v3.text-match+json") |
| 323 | + req.Header.Set("Accept", "application/vnd.github.v3.text-match+json") |
344 | 324 | } |
345 | | - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) |
346 | 325 |
|
347 | 326 | return s.client.Do(ctx, req, result) |
348 | 327 | } |
0 commit comments