-
Notifications
You must be signed in to change notification settings - Fork 233
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
Get rid of Iris and use julienschmidt/httprouter instead #20
Conversation
http.Error(w, string(jsonError("body_missing")), http.StatusBadRequest) | ||
return | ||
} | ||
json.NewDecoder(r.Body).Decode(&aTXT) |
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.
The error return value is not checked here, is this on purpose to allow empty POST bodies?
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.
It indeed is the idea to allow empty POST bodies, as the only parameter for registration, "allowfrom" is optional.
You have good eyes though, as the body check shouldn't be there, even though it's really not completely empty in pretty much any real world situation.
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.
That is also a good point, however I was actually talking about the return value of Decode, which can be an error and is not checked in this case, which means that there is no indication that invalid JSON was sent. Of course, when you check it and the body is empty, it will return an error (probably EOF), so that should still be allowed.
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.
Let's continue the discussion on issue #23 so it doesn't get buried to the PR graveyard.
* Replace iris with httprouter * Linter fixes * Finalize iris removal * Vendor dependencies for reproducable builds * Api tests are back
Iris can't keep the API stable, and while looking into it, found out a lot of drama behind the scenes too. This change will also rid us of hefty dependency stack brought in by iris.
Brought back the HTTP api tests as well!
Fixes #16
Fixes #11