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

AdminCreateOrg json unmarshal error #40

Open
fxaguessy opened this issue Feb 18, 2017 · 5 comments
Open

AdminCreateOrg json unmarshal error #40

fxaguessy opened this issue Feb 18, 2017 · 5 comments
Labels

Comments

@fxaguessy
Copy link

fxaguessy commented Feb 18, 2017

Trying to use gitea go sdk (import "code.gitea.io/sdk/gitea"), the
client.AdminCreateOrg() function returns the following error

json: cannot unmarshal array into Go value of type map[string]interface {}

running with gitea server in docker : 2016 Gitea Version: 1.0.0+276-g9d2b8302


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@lunny lunny added the kind/bug label Feb 18, 2017
@fxaguessy
Copy link
Author

FYI, the bug is located in https://github.com/go-gitea/go-sdk/blob/master/gitea/gitea.go#L76 .
When there is an error, the JSON string is, for example [{"fieldNames":["UserName"],"classification":"RequiredError","message":"Required"}] (a one element array)

@lunny
Copy link
Member

lunny commented Feb 21, 2017

Thanks. Could you send a PR to fix that?

@fxaguessy
Copy link
Author

Should this be corrected rather in go-sdk or in gitea API (https://github.com/go-gitea/gitea/blob/master/routers/api/v1/admin/org.go) ?

@lunny lunny added this to the 1.2.0 milestone May 2, 2017
@bkcsoft
Copy link
Member

bkcsoft commented Oct 28, 2017

The issue is in Gitea API. Since we're returning a 201 Created instead of 400 Bad Request

Missed the array vs map part. We should check in SDK whether it's an array of errors or not :/

@jstrachan
Copy link

BTW for errors of kind 422 this PR fixes this issue #89

though there could be other 4XX errors that are returned we may want to do something similar. I wonder if we should return all other 4XX errors like the 422 error in this PR?

@lunny lunny removed this from the 1.2.0 milestone Feb 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants