Fix typos that causes errors
This commit is contained in:
parent
755faf6402
commit
b4c35e82bb
3 changed files with 4 additions and 4 deletions
|
@ -218,7 +218,7 @@ func reqToken(requiredScope string) func(ctx *context.APIContext) {
|
|||
scope := ctx.Data["ApiTokenScope"].(auth_model.AccessTokenScope)
|
||||
allow, err := scope.HasScope(requiredScope)
|
||||
if err != nil {
|
||||
ctx.Error(http.StatusUnauthorized, "reqToken", "parsing token failed")
|
||||
ctx.Error(http.StatusUnauthorized, "reqToken", "parsing token failed: "+err.Error())
|
||||
return
|
||||
}
|
||||
if !allow {
|
||||
|
@ -794,7 +794,7 @@ func Routes(ctx gocontext.Context) *web.Route {
|
|||
}, reqToken(""))
|
||||
|
||||
// Repositories
|
||||
m.Post("/org/{org}/repos", reqToken("auth_model.AccessTokenScopeAdminOrg"), bind(api.CreateRepoOption{}), repo.CreateOrgRepoDeprecated)
|
||||
m.Post("/org/{org}/repos", reqToken(auth_model.AccessTokenScopeAdminOrg), bind(api.CreateRepoOption{}), repo.CreateOrgRepoDeprecated)
|
||||
|
||||
m.Combo("/repositories/{id}", reqToken(auth_model.AccessTokenScopeRepo)).Get(repo.GetByID)
|
||||
|
||||
|
|
|
@ -446,7 +446,7 @@ func TestAPIOrgRepoCreate(t *testing.T) {
|
|||
for _, testCase := range testCases {
|
||||
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: testCase.ctxUserID})
|
||||
session := loginUser(t, user.Name)
|
||||
token := getTokenForLoggedInUser(t, session)
|
||||
token := getTokenForLoggedInUser(t, session, "repo")
|
||||
req := NewRequestWithJSON(t, "POST", fmt.Sprintf("/api/v1/org/%s/repos?token="+token, testCase.orgName), &api.CreateRepoOption{
|
||||
Name: testCase.repoName,
|
||||
})
|
||||
|
|
|
@ -219,7 +219,7 @@ func TestAPIListPageRevisions(t *testing.T) {
|
|||
session := loginUser(t, username)
|
||||
token := getTokenForLoggedInUser(t, session, "repo")
|
||||
|
||||
urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/wiki/revisions/Home>token=%s", username, "repo1", token)
|
||||
urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/wiki/revisions/Home?token=%s", username, "repo1", token)
|
||||
|
||||
req := NewRequest(t, "GET", urlStr)
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
|
|
Loading…
Add table
Reference in a new issue