1
0
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:
Gerasimos (Makis) Maropoulos
2019-08-03 04:41:09 +03:00
parent 970279deb8
commit b37b369b51
15 changed files with 985 additions and 133 deletions

View File

@@ -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):