Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Proposal: Make preview features configurable

未关闭
#999 17 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
停滞
技术栈
go
领域
api

调研方向

首先追踪默认 preview Accept 标头和 ListOptions 的处理方式;该 issue 未指定任何文件或测试。定义 RequestOptions API,并确定新 API 应如何处理 preview 标头,然后验证 repository-list 请求可以省略不需要的标头。

由索引模型根据 Issue 内容生成。

描述

NeedsInvestigation

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.

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.

主要语言
Go
星标
11.3k
派生
2.5k
平均合并
1 天 16 小时
30 天内合并 PR
51

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

google/go-github 的其他 Issue

查看 google/go-github 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。