fix: Rename DecodeWasmContext to decodeWasmContext

This commit is contained in:
Prad Nukala 2024-12-29 00:42:28 -05:00
parent b727a52193
commit 9b0a78adda

View File

@ -10,12 +10,11 @@ import (
"github.com/labstack/echo/v4"
)
// AI! Fix any lint errors
func WASMMiddleware(next echo.HandlerFunc) echo.HandlerFunc {
return func(c echo.Context) error {
// Extract WASM context from headers
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)
}
}
@ -24,7 +23,7 @@ func WASMMiddleware(next echo.HandlerFunc) echo.HandlerFunc {
}
// 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)
if err != nil {
return nil, err