Skip to content
This repository was archived by the owner on Jun 8, 2019. It is now read-only.

Add method to set Sudo header #144

Merged
merged 1 commit into from
Feb 15, 2019
Merged

Conversation

DrMegavolt
Copy link

Api doc says I can execute requests on behalf of another user by setting header Sudo

This PR adds such possibility

Usage

	client := gitea.NewClient(os.Getenv("GITEA_HOST"), os.Getenv("GITEA_TOKEN"))
	client.SetSudo(username) // this is new 
	userRepos, err := client.ListMyRepos()

If I have GITEA_TOKEN as Admin User but results will contain repos of username

For reference the test in Gitea that checks if Sudo works
https://github.com/go-gitea/gitea/blob/7096085f2b07246315e95e394b180ce9729efbb0/integrations/api_admin_test.go#L81

@techknowlogick techknowlogick merged commit ad9bcd6 into go-gitea:master Feb 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants