style: status change to std http status (#758)

This commit is contained in:
baerwang
2024-01-08 11:07:11 +08:00
committed by GitHub
parent c250e850d5
commit b1e4cf9492
8 changed files with 35 additions and 24 deletions

View File

@@ -2,6 +2,7 @@ package main
import (
"fmt"
"net/http"
"runtime"
. "github.com/alibaba/higress/plugins/wasm-go/pkg/wrapper"
@@ -34,6 +35,6 @@ func onHttpRequestHeaders(ctx HttpContext, config MyConfig, log Log) types.Actio
log.Infof("alloc success, point address: %p", b)
memstats := fmt.Sprintf(`{"Sys": %d,"HeapSys": %d,"HeapIdle": %d,"HeapInuse": %d,"HeapReleased": %d}`, m.Sys, m.HeapSys, m.HeapIdle, m.HeapInuse, m.HeapReleased)
log.Info(memstats)
proxywasm.SendHttpResponse(200, [][2]string{{"Content-Type", "application/json"}}, []byte(memstats), -1)
proxywasm.SendHttpResponse(http.StatusOK, [][2]string{{"Content-Type", "application/json"}}, []byte(memstats), -1)
return types.ActionContinue
}