mirror of
https://github.com/onsonr/sonr.git
synced 2025-03-10 13:07:09 +00:00
fix: Rename DecodeWasmContext to decodeWasmContext
This commit is contained in:
parent
b727a52193
commit
9b0a78adda
@ -10,12 +10,11 @@ import (
|
|||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AI! Fix any lint errors
|
|
||||||
func WASMMiddleware(next echo.HandlerFunc) echo.HandlerFunc {
|
func WASMMiddleware(next echo.HandlerFunc) echo.HandlerFunc {
|
||||||
return func(c echo.Context) error {
|
return func(c echo.Context) error {
|
||||||
// Extract WASM context from headers
|
// Extract WASM context from headers
|
||||||
if wasmCtx := c.Request().Header.Get("X-Wasm-Context"); wasmCtx != "" {
|
if wasmCtx := c.Request().Header.Get("X-Wasm-Context"); wasmCtx != "" {
|
||||||
if ctx, err := DecodeWasmContext(wasmCtx); err == nil {
|
if ctx, err := decodeWasmContext(wasmCtx); err == nil {
|
||||||
c.Set("wasm_context", ctx)
|
c.Set("wasm_context", ctx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -24,7 +23,7 @@ func WASMMiddleware(next echo.HandlerFunc) echo.HandlerFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// decodeWasmContext decodes the WASM context from a base64 encoded string
|
// decodeWasmContext decodes the WASM context from a base64 encoded string
|
||||||
func DecodeWasmContext(ctx string) (map[string]any, error) {
|
func decodeWasmContext(ctx string) (map[string]any, error) {
|
||||||
decoded, err := base64.StdEncoding.DecodeString(ctx)
|
decoded, err := base64.StdEncoding.DecodeString(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
x
Reference in New Issue
Block a user