-
Notifications
You must be signed in to change notification settings - Fork 3
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
chore(faucet): compliency gno/faucet and gnoweb #8
Conversation
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.
Please see my comment about request standardization 🙏
I think we don't need to make this change on the side of this lib, but on gnoweb
err := r.ParseForm() | ||
if err != nil { | ||
http.Error(w, "invalid request body", http.StatusBadRequest) | ||
|
||
return | ||
} |
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.
Nitpick: you can inline this
if err := r.ParseForm(); err != nil {
http.Error(w, "invalid request body", http.StatusBadRequest)
return
}
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 didn't put it like that to avoid redefine err
lower, but i'm fine for adding a var err error
:)
if to := r.FormValue("toaddr"); to != "" { | ||
requests = Requests{ | ||
{To: to}, | ||
} |
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 do not like the fact we are modelling the behavior of a generic TM2 faucet based on gnoweb
(and exact field names in gnoweb
. The faucet is envisioned to work through POST requests of a specific format (or we can define our own handlers, endpoints, the faucet lib allows for that).
We are deprecating the old gno faucet anyways, so might as well make the change now.
I propose we take one of these routes:
- modify
gnoweb
to send a POST with a standard body that is expected in this faucet implementation, this way only 1 thing is changed, and it's on the Gnoweb side (easy route, and longterm the final version, since we are deprecating the old faucet) - use this faucet as a lib in gno, and extend the faucet to have specific handlers / routes you would use for gnoweb (define custom handlers, like we did for gnochess). This option is less favorable, because it just introduces complexity we'd drop later on when deleting the old faucet
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.
100% ok with this, i just choose a quicker solution for having a fix to work with
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.
but the "form" system is an easier system for the way we're using gno/templating html
Closing this in favor of gnolang/gno#1614 |
No description provided.