4 ms·
Admittedly I'm probably just not the best programmer in the world, but I just copy and paste something like this: if err := c.ShouldBindHeader(&headers); err !
by ownagefool 4y ago
Admittedly I'm probably just not the best programmer in the world, but I just copy and paste something like this:
if err := c.ShouldBindHeader(&headers); err != nil {
log.Println(err.Error())
c.JSON(http.StatusUnauthorized, gin.H{"error": err.Error()})
return
}
I don't think I give any more or less thought about it overall. Honestly, I'd probably rather just write the happy path, but still like the language either way.