Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
zvodd
@zvodd
@wsantos "Pre adds middleware to the chain which is run before router." " Use adds middleware to the chain which is run after router."
https://godoc.org/gopkg.in/labstack/echo.v4#Echo.Pre
So I guess Pre middleware will run on every incoming connection, regardless of the URL path.
Waldecir Santos
@wsantos
Thanks @zvodd , I've another question, I've created a middleware that retrieves the user from db if he/she is logged in, but now, I'm not sure how to "automatically" expose it to the template, I really don't want to add it on every single c.Render any idea or options on how to do it ?
OpoOpo
@OpoOpo
Hi, is it possible to get an error when binding JSON to the struct which containing for example int, but JSON will not contain specific key?
OpoOpo
@OpoOpo
I found one method with using pointers on types but it's really not user friendly
William Méndez
@Wilo
Hi folks, has anyone used Buffalo / Pop ORM in their Echo project?
vertazzar
@vertazzar
Hey guys, I'm having issues registering a handler http method that's non standard (webdav) so for example when registering server.Add("REPORT", handler) it won't be handled. According to the checkMethodNotAllowed() method, it will only search trough the ones listed here: https://github.com/labstack/echo/blob/master/router.go#L264 is there any way to extend this?
vertazzar
@vertazzar
well, it appears that this is not possible, will have to fork the package
Tu Le
@tuleminh3196
I am working on a feature related to user authorization. I need to take the HandlerFunc name in middleware for checking if the user has permission to request this API or not. So How can I get the HandlerFunc name in middleware?
Renatho Azevedo
@renathoaz
Hi there, is there a way to use jwt middleware with gorilla websocket for authentication ?
Arun Gopalpuri
@arun0009
@lammel - or any echo framework moderator review my PR please? labstack/echo#1628
Thanks!
sucream
@sucream

I created a struct to bind like this

type Something struct {
        UserID            string `form:"user"`
    TopicList         *[]uint  `form:"newTopic"`
}

in this moment, can i bind request like below?

POST /something HTTP/1.1
Host: localhost
Content-Type: application/x-www-form-urlencoded

user=test&newTopic=2&newTopic=5
sucream
@sucream
A user has many topic and i want to set many topic list in my request and bind it to my struct. Thanks.
xandout
@xandout
Is it possible to detect the filename of c.FormFile before accepting the entire file? I would like to reject an upload before the user has uploaded the entire file.
Gursharan singh
@singh-gursharan
how can we prevent bind function to bind some form fields to the struct fields?

For example
type student struct{
ID int form:"-"
Name string form:"name"
Details string form:"details"
}

Here i do not want bind function in echo to bind id from the create student request to ID. but if i post like. -:1 name:student details:student

it will bind - value to ID which i do not want.

And if i skip form tag as shown below
type student struct{
ID int
Name string form:"name"
Details string form:"details"
}

then do a post request

id:1 name:student details:student

now the bind function will bind id with ID.

the problem is I am not able to skip binding for ID field

Arun Gopalpuri
@arun0009
How can i get http.Handler from echo context? I have to call a custom middleware and it requires http.Handler
Steve Mynott
@stmuk
Hi I'm trying to log the system version as part of startup and e.Logger.Info() doesn't seem to work until e.Start ? Do I need to write my own run once middleware?
Steve Mynott
@stmuk
hmm I think I see what's happening
Albert Wong
@shimmerh
hi guys, does anybody know set proxy (middleware) timeout ?I cant find this param in ProxyConfig
Lulu Cheng
@l1990790120
hello, is there any recommendation middleware to use redis caching w/ echo?
Bhuvanachandra G
@runeboy
Can somebody help me with this query?
HellP
@RebirthLee
https://echo.labstack.com/guide/context#extending-context, This guide don't work on echo/v4, I want some solutions.
Feliks
@richfuns
Hi, there
Enver Bisevac
@enverbisevac
Hi, I think in CORS middleware configuration for AllowOrigins should accept regex, so it would be nice to have something like wildcard subdomain
Olupot.D
@oludouglas
Hi guys
I've been using the std lib and decided to try out echo
I'm trying to test the session module but keep getting the same "session" session not found
anyone else encountered this before and what could I be doing wrong
 e := echo.New()
 e.Use(session.Middleware(sessions.NewCookieStore([]byte("secret"))))

 // and try to access it in handler like below
 func (h *Handler) loginUser(c echo.Context) error {
    sess, err := session.Get("session", c)
    if err != nil {
        log.Fatal(err)
        return err
    }
 }
thanks in advance
atecce
@atecce
hai! for some reason i'm having issues with echo.NotFoundHandler in v4
i'm almost certainly missing something obvious. sec
 echo.NotFoundHandler = func(c echo.Context) error {
   log.Debug("calling not found handler")
   return c.String(http.StatusNotFound, "found the not found handler!")
 }
i neither see the debug log nor the string i'm attempting to return, just 404 page not found which i believe is just http.StatusNotFound stringified
does anyone use this? is there a possible bug here? have tried it before and after the definition of e := echo.New()
atecce
@atecce
halp
Carlos Revillo
@crevillo
hello, i'm new in golang and this framework. i have defined a route like e.GET("/users", GetUsers). No, in my handlers/users.go i have a method like func GetUsers(c echo.Context) error {
2 replies
How should i define the route and the GetUers method to pass a parameter? i would lilke to have something like `func GetUsers(c echo.Context, whatever *usersController) error {```. this userWhatever will have injected a service and this service will depend on the users repository. any example on how to acomplish that? otoh, maybe that's not a way to go?
hy
@eerycode_twitter
I'm going to caches the response of the echo framework to the redis DB.
Is there anyone who can tell me how??
b, _ := json.Marshal(c.Response())
    err = client.Set(ctx, key, b, 0).Err()
I don't think this is the right way....
Vadim Yermolin
@vadimyer

Hey guys. How can I actually bind a request with a nested object (in x-www-form-urlencoded format) like this?

client_id=b9ceb6e9-4ba2-45d7-84a3-1085f4417153&geetest[challenge]=522748524ad010358705b6852b81be4c&geetest[seccode]=398c3d01d4fef0877fcb417c567216b7&geetest[success]=1&geetest[validate]=398c3d01d4fef0877fcb417c567216b7&grant_type=password&password=secret1&username=test@example.com

I have a struct with a field called GeeTest which is a geetest.Request struct with corresponding string fields and form tags. But Echo bind seems to not parse this object completely...

Steve Mynott
@stmuk
anyone know how to disable tlsv1.0 & 1.1 before I dig deeper?
jfitzpa22
@jfitzpa22
Does anyone know how to pass the response from a route to a gob encoder?
Steve Mynott
@stmuk
Well I managed it via
    tlsConfig := &tls.Config{MinVersion: tls.VersionTLS12, Certificates: []tls.Certificate{cert}}
    s := &http.Server{Addr: ":4443", TLSConfig: tlsConfig}
    e.Logger.Fatal(e.StartServer(s))
Aguirre
@naguirre_gitlab

Hi, i'm using flutter as websocket client of a backend application using echo and golang. My client is able to connect to ws://echo.websocket.org without error, but if i connect to echo websocket, i get this error flutter: WebSocketChannelException: WebSocketChannelException: WebSocketException: Connection to 'http://192.168.1.27:5000/ws#' was not upgraded to websocket I tired with websocket client browser based and i'm able to connect to echo ws server. So it seems that flutter is doing something different than others. I read a lot about this problem with flutter as websocket client, and it seems that actix-web got the same kind of problem here : actix/actix-web#567
With this comment interresting comment : fixed in master.

dart client sends "content-length" header in request, and that is the problem.

by any chance, echo could have this same kind of fix ?
Aguirre
@naguirre_gitlab
hum, i used github.com/gorilla/websocket and now it works ! sorry for the noise :)