Skip to content

Commit aeabbc1

Browse files
committed
fixed json serializaiton after moved from anonymous struct to named one
1 parent 46b9af2 commit aeabbc1

File tree

1 file changed

+9
-8
lines changed
  • packages/orchestrator/internal/proxy

1 file changed

+9
-8
lines changed

packages/orchestrator/internal/proxy/proxy.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import (
66
_ "embed"
77
"encoding/json"
88
"fmt"
9-
"github.com/e2b-dev/infra/packages/shared/pkg/meters"
10-
"github.com/e2b-dev/infra/packages/shared/pkg/smap"
119
"go.uber.org/zap"
1210
"html/template"
1311
"net/http"
@@ -17,6 +15,9 @@ import (
1715
"strconv"
1816
"strings"
1917
"time"
18+
19+
"github.com/e2b-dev/infra/packages/shared/pkg/meters"
20+
"github.com/e2b-dev/infra/packages/shared/pkg/smap"
2021
)
2122

2223
//go:embed proxy_browser_502.html
@@ -32,9 +33,9 @@ type htmlTemplateData struct {
3233
}
3334

3435
type jsonTemplateData struct {
35-
error string
36-
sandbox_id string
37-
port uint64
36+
Error string `json:"error"`
37+
SandboxId string `json:"sandbox_id"`
38+
Port uint64 `json:"port"`
3839
}
3940

4041
type SandboxProxy struct {
@@ -181,9 +182,9 @@ func (p *SandboxProxy) buildHtmlClosedPortError(sandboxId string, host string, p
181182

182183
func (p *SandboxProxy) buildJsonClosedPortError(sandboxId string, port uint64) []byte {
183184
response := jsonTemplateData{
184-
error: "The sandbox is running but port is not open",
185-
sandbox_id: sandboxId,
186-
port: port,
185+
Error: "The sandbox is running but port is not open",
186+
SandboxId: sandboxId,
187+
Port: port,
187188
}
188189

189190
responseBytes, _ := json.Marshal(response)

0 commit comments

Comments
 (0)