Pull : Add a Fallback for GetPullRequestDiff/Patch #399
No reviewers
Labels
No Label
has/backport
has/pull
in progress
invalid
kind/breaking
kind/bug
kind/build
kind/deployment
kind/docs
kind/enhancement
kind/feature
kind/lint
kind/proposal
kind/question
kind/refactor
kind/security
kind/testing
kind/translation
kind/ui
need/backport
priority/critical
priority/low
priority/maybe
priority/medium
reviewed/duplicate
reviewed/invalid
reviewed/wontfix
skip-changelog
status/blocked
status/needs-feedback
status/needs-reviews
status/wip
upstream/gitea
No Milestone
No Assignees
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: gitea/go-sdk#399
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "6543/go-sdk:pull_get-diff-patch_add-fallback"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
follow up of #398
and add TESTs
@ -59,0 +61,4 @@
assert.Len(t, diff, 1310)
patch, err := c.GetPullRequestPatch(c.username, repoName, pullUpdateFile.Index)
assert.NoError(t, err)
assert.True(t, len(patch) > len(diff))
INFO: since patch contain time infos (witch change each test) i cant check for exact lenth
I legitimately wasn't sure how to write tests for this, so I promise if I've got more to contribute in the future, there will be tests. =)
@ -222,2 +222,4 @@
}
// getPullRequestDiffOrPatch gets the patch or diff file as bytes for a PR
func (c *Client) getPullRequestDiffOrPatch(owner, repo, kind string, index int64) ([]byte, error) {
Probably should be
getPullRequestDiffOrPatch
? =)@abayer good first catch :)
@ -75,2 +75,4 @@
}
func (c *Client) getWebResponse(method, path string, body io.Reader) ([]byte, error) {
req, err := http.NewRequest(method, c.url+path, body)
should auth be included in this request?
it would not work ... that's why https://github.com/go-gitea/gitea/pull/11751 was created
so fallback only works by using the existing web endpoint wo do not need auth
@abayer if you are on linux
make test-instance
create the test instance you can test against withmake test