-
Notifications
You must be signed in to change notification settings - Fork 111
fix: request license information from GitLab API #6593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
7622661
ba135e4
dd9935e
14914e4
690e6d1
813dba0
36ecd93
0ca66fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -143,9 +143,17 @@ | |
| properties.RepoPropertyIsPrivate: true, | ||
| properties.RepoPropertyIsArchived: false, | ||
| properties.RepoPropertyIsFork: false, | ||
| properties.RepoPropertyLicense: "mit", | ||
|
Check failure on line 146 in internal/providers/gitlab/properties_test.go
|
||
| }), | ||
| wantErr: false, | ||
| gitLabServerMockFunc: func(w http.ResponseWriter, _ *http.Request) { | ||
| gitLabServerMockFunc: func(w http.ResponseWriter, r *http.Request) { | ||
| // Verify the query parameter you added is being sent | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same comment here as in a previous review -- will this comment make sense when reading the code in 3 months? |
||
| if r.URL.Query().Get("license") != "true" { | ||
| t.Errorf("expected query param license=true, got %s", r.URL.RawQuery) | ||
| w.WriteHeader(http.StatusBadRequest) | ||
| return | ||
| } | ||
|
|
||
| resp := &gitlab.Project{ | ||
| ID: 1, | ||
| Name: "project-1", | ||
|
|
@@ -156,6 +164,9 @@ | |
| Namespace: &gitlab.ProjectNamespace{ | ||
| Path: "group", | ||
| }, | ||
| License: &gitlab.ProjectLicense{ | ||
| Name: "mit", | ||
| }, | ||
| } | ||
|
|
||
| w.Header().Set("Content-Type", "application/json") | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,6 +53,7 @@ func (c *gitlabClient) getGitLabProject( | |
| if err != nil { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| return nil, fmt.Errorf("failed to join URL path for project using upstream ID: %w", err) | ||
| } | ||
| projectURLPath = projectURLPath + "?license=true" | ||
|
|
||
| // NOTE: We're not using github.com/xanzy/go-gitlab to do the actual | ||
| // request here because of the way they form authentication for requests. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is just:
Since it's from this package, not from the shared
propertiespackage.