1
1
package sdkserver
2
2
3
3
import (
4
+ "encoding/base64"
4
5
"encoding/json"
5
6
"fmt"
6
7
"net/http"
@@ -175,8 +176,7 @@ func (s *server) removeAllWithPrefixInWorkspace(w http.ResponseWriter, r *http.R
175
176
type writeFileInWorkspaceRequest struct {
176
177
workspaceCommonRequest `json:",inline"`
177
178
FilePath string `json:"filePath"`
178
- Contents string `json:"contents"`
179
- Base64EncodedInput bool `json:"base64EncodedInput"`
179
+ Contents []byte `json:"contents"`
180
180
}
181
181
182
182
func (s * server ) writeFileInWorkspace (w http.ResponseWriter , r * http.Request ) {
@@ -198,8 +198,8 @@ func (s *server) writeFileInWorkspace(w http.ResponseWriter, r *http.Request) {
198
198
prg ,
199
199
reqObject .Env ,
200
200
fmt .Sprintf (
201
- `{"workspace_id": "%s", "file_path": "%s", "file_contents ": "%s", "write_file_base64_encoded_input": %t }` ,
202
- reqObject .ID , reqObject .FilePath , reqObject . Contents , reqObject .Base64EncodedInput ,
201
+ `{"workspace_id": "%s", "file_path": "%s", "body ": "%s"}` ,
202
+ reqObject .ID , reqObject .FilePath , base64 . StdEncoding . EncodeToString ( reqObject .Contents ) ,
203
203
),
204
204
)
205
205
if err != nil {
@@ -249,7 +249,6 @@ func (s *server) removeFileInWorkspace(w http.ResponseWriter, r *http.Request) {
249
249
type readFileInWorkspaceRequest struct {
250
250
workspaceCommonRequest `json:",inline"`
251
251
FilePath string `json:"filePath"`
252
- Base64EncodeOutput bool `json:"base64EncodeOutput"`
253
252
}
254
253
255
254
func (s * server ) readFileInWorkspace (w http.ResponseWriter , r * http.Request ) {
@@ -271,8 +270,8 @@ func (s *server) readFileInWorkspace(w http.ResponseWriter, r *http.Request) {
271
270
prg ,
272
271
reqObject .Env ,
273
272
fmt .Sprintf (
274
- `{"workspace_id": "%s", "file_path": "%s", "read_file_base64_encode_output": %t }` ,
275
- reqObject .ID , reqObject .FilePath , reqObject . Base64EncodeOutput ,
273
+ `{"workspace_id": "%s", "file_path": "%s"}` ,
274
+ reqObject .ID , reqObject .FilePath ,
276
275
),
277
276
)
278
277
if err != nil {
0 commit comments