google / google/go-github

Proposal: Make preview features configurable

Abierto
#999 17 comentarios 1 reacción 0 asignados Ver en GitHub
NeedsInvestigation
Lenguaje dominante
Go
Estrellas
11.3k
Forks
2.5k
Merge medio
1 d 20 h
PR fusionados (30 d)
52

Descripción

## Problem

A project I'm working on has an issue where a list of repos is returning a Server Error due to an additional `Accept` header being added (The "mediaTypeCodesOfConductPreview" header).

Removing this header fixes the problem but I can't do this with the current library implementation.

## Solution

Instead of adding these headers by default, we could move them to an Options parameter similar to ListOptions.

```go
type RequestOptions {
acceptHeaders []string
}
```

### Pros

- Allows developers to control which headers to add (including headers the library may not control)
- Removes the maintenance of adding / removing headers from library owners
- Opens the door for any additional request options in the future.
- This will remove the need for comments like `// TODO: remove custom Accept headers when APIs fully launch.`

### Cons

- Forces users to care about headers
- While a con, users should know if a feature they are using is preview or not and subject to change

## Concerns

The only major concern I have with this is approach is that it gets fuzzy what to do with entirely new API's (for example the checks API).

For consistency the API could still require the developer to add the header.
For a sane API the API could add the header with the expectation that the header is removed as soon as possible, but again moves the burden on to the library.

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Empieza rastreando cómo se gestionan los encabezados Accept de preview predeterminados y ListOptions; el issue no menciona archivos ni pruebas. Define la API de RequestOptions y resuelve cómo deben gestionar las nuevas APIs los encabezados de preview; después, verifica que las solicitudes para listar repositorios puedan omitir el encabezado no deseado.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
go
Área
api
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.