Swap http.Handler with Gin Gonic - #3850
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3850 +/- ##
==========================================
- Coverage 43.46% 43.29% -0.17%
==========================================
Files 326 324 -2
Lines 16808 16949 +141
==========================================
+ Hits 7305 7338 +33
- Misses 8757 8859 +102
- Partials 746 752 +6
Continue to review full report at Codecov.
|
tomasmik
left a comment
There was a problem hiding this comment.
Could we add a flag or something to control gin mode? By default both should be loaded with release and have the possibility to switch to debug if needed. It now prints logs of debug logs which are probably not needed.
| func (api *authenticationAPI) Login(httpRes http.ResponseWriter, httpReq *http.Request, _ httprouter.Params) { | ||
| func (api *authenticationAPI) Login(c *gin.Context) { | ||
| httpReq := c.Request | ||
| httpRes := c.Writer |
There was a problem hiding this comment.
Well this seems a bit backwards to me. From a quick search it seems that most of the SendError or WriteAsJSON are only used in tequila and they all write JSON. So in theory functions in tequilapi/utils/utils.go could just accept interface:
type JSONErrorWriter interface {
JSON(code int, body interface{})
}
And you could just pass c into those funcs. I guess this could also be improvement num 2 🤷🏻
There was a problem hiding this comment.
Like it says in the commit description: Quick & Dirty, I would like to throw away those utils and maybe swap them with a dependency to standardize this across all projects that use gin. So I would wish to leave this for another iteration :) this PR is large as it is.
There was a problem hiding this comment.
Sure no problem, just pointing an issue to open after this is merged for the future.
Signed-off-by: Mantas Domaševičius <mantas@mysterium.network>
Signed-off-by: Mantas Domaševičius <mantas@mysterium.network>
Signed-off-by: Mantas Domaševičius <mantas@mysterium.network>
Signed-off-by: Mantas Domaševičius <mantas@mysterium.network>
Signed-off-by: Mantas Domaševičius <mantas@mysterium.network>
Signed-off-by: Mantas Domaševičius <mantas@mysterium.network>
Signed-off-by: Mantas Domaševičius <mantas@mysterium.network>
Since we use Gin in all other projects