mirror of
https://github.com/kataras/iris.git
synced 2025-12-17 18:07:01 +00:00
add content negotiation feature, add context.ReadYAML and fix https://github.com/kataras/neffos/issues/1#issuecomment-515698536
Former-commit-id: 9753e3e45c7c24788b97814d3ecfb4b03f5ff414
This commit is contained in:
@@ -68,8 +68,17 @@ func main() {
|
||||
SigningMethod: jwt.SigningMethodHS256,
|
||||
})
|
||||
|
||||
idGen := func(ctx iris.Context) string {
|
||||
if username := ctx.GetHeader("X-Username"); username != "" {
|
||||
return username
|
||||
}
|
||||
|
||||
return websocket.DefaultIDGenerator(ctx)
|
||||
}
|
||||
|
||||
// serves the endpoint of ws://localhost:8080/echo
|
||||
websocketRoute := app.Get("/echo", websocket.Handler(websocketServer))
|
||||
// with optional custom ID generator.
|
||||
websocketRoute := app.Get("/echo", websocket.Handler(websocketServer, idGen))
|
||||
|
||||
if enableJWT {
|
||||
// Register the jwt middleware (on handshake):
|
||||
|
||||
Reference in New Issue
Block a user