Skip to content

Commit fe44bb9

Browse files
authored
Merge pull request #10 from coderbuzz/fix/json-input-data
fix: Input.Data []byte di-json-unmarshal sebagai base64, ganti ke string
2 parents dc5b451 + 229ba47 commit fe44bb9

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎internal/http/console.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func (h *ConsoleHandler) ServeWS(w http.ResponseWriter, r *http.Request) {
111111
}
112112
}
113113

114-
inCh <- ssh.Input{Data: msg}
114+
inCh <- ssh.Input{Data: string(msg)}
115115
}
116116
}()
117117

‎internal/ssh/client.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func (c *Client) Shell(ctx context.Context, rows, cols int) (<-chan Output, chan
129129
continue
130130
}
131131
if len(input.Data) > 0 {
132-
wIn.Write(input.Data)
132+
wIn.Write([]byte(input.Data))
133133
}
134134
}
135135
}()

‎internal/ssh/interface.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type WindowSize struct {
1616
}
1717

1818
type Input struct {
19-
Data []byte
19+
Data string
2020
Resize *WindowSize
2121
}
2222

‎internal/ssh/mock.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func (m *MockClient) Shell(ctx context.Context, rows, cols int) (<-chan Output,
7373
if input.Resize != nil {
7474
continue
7575
}
76-
for _, b := range input.Data {
76+
for _, b := range []byte(input.Data) {
7777
if b == '\r' {
7878
outCh <- Output{Data: []byte("\r\n")}
7979
cmd := string(buf)

0 commit comments

Comments
 (0)