KnpLabs / KnpLabs/php-github-api

Invalid url for get reference endpoint?

未关闭
#1,037 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
PHP
星标
2.2k
派生
587
PR 合并指标
30 天内没有已合并 PR

描述

While this code works fine for most use cases:

https://github.com/KnpLabs/php-github-api/blob/de2f27846139e7b4b92dcad9ff77660d0dc5dfad/lib/Github/Api/GitData/References.php#L83

It looks like that `GET /refs/{ref}` is an undocumented endpoint and it returns an array of references when an exact reference is not found, but other similar references are found in the repo.

> Current GitHub docs tells to use `GET /ref/{ref}` URL: https://docs.github.com/en/rest/reference/git#get-a-reference

My story: I have the following references in the repo:

- accepted-1-1
- accepted-1-1-1

When I try to get `accepted-1` reference using `references()->show(..)` I get the following response, but I expect zero results:

Screenshot 2021-11-11 at 22 15 41

If I change `GET /refs/{ref}` to `GET /ref/{ref}` in `References.php` it starts throwing a 404 not found exception as expected.

贡献指南

这个仓库没有索引到贡献指南

调研方向

Start in lib/Github/Api/GitData/References.php at the referenced line and compare the requested path with GitHub's current get-a-reference documentation. Reproduce the lookup for a partial reference and verify that an exact missing reference no longer returns similarly named references; update the relevant behavior and add or adjust coverage where the repository's existing tests cover this endpoint.

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

评估

技术栈
github, php
领域
api
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

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