@@ -51,7 +51,9 @@ func (e *ExecdClient) Ping(ctx context.Context) error {
5151// ListContexts returns all active code execution contexts for the given language.
5252func (e * ExecdClient ) ListContexts (ctx context.Context , language string ) ([]CodeContext , error ) {
5353 var result []CodeContext
54- path := "/code/contexts?language=" + url .QueryEscape (language )
54+ params := url.Values {}
55+ params .Set ("language" , language )
56+ path := "/code/contexts?" + params .Encode ()
5557 err := e .client .doRequest (ctx , http .MethodGet , path , nil , & result )
5658 return result , err
5759}
@@ -85,7 +87,9 @@ func (e *ExecdClient) DeleteContext(ctx context.Context, contextID string) error
8587
8688// DeleteContextsByLanguage deletes all code execution contexts for the given language.
8789func (e * ExecdClient ) DeleteContextsByLanguage (ctx context.Context , language string ) error {
88- path := "/code/contexts?language=" + url .QueryEscape (language )
90+ params := url.Values {}
91+ params .Set ("language" , language )
92+ path := "/code/contexts?" + params .Encode ()
8993 return e .client .doRequest (ctx , http .MethodDelete , path , nil , nil )
9094}
9195
@@ -97,7 +101,9 @@ func (e *ExecdClient) ExecuteCode(ctx context.Context, req RunCodeRequest, handl
97101
98102// InterruptCode interrupts the currently running code execution.
99103func (e * ExecdClient ) InterruptCode (ctx context.Context , sessionID string ) error {
100- path := "/code?id=" + url .QueryEscape (sessionID )
104+ params := url.Values {}
105+ params .Set ("id" , sessionID )
106+ path := "/code?" + params .Encode ()
101107 return e .client .doRequest (ctx , http .MethodDelete , path , nil , nil )
102108}
103109
@@ -131,7 +137,9 @@ func (e *ExecdClient) RunCommand(ctx context.Context, req RunCommandRequest, han
131137
132138// InterruptCommand interrupts the currently running command execution.
133139func (e * ExecdClient ) InterruptCommand (ctx context.Context , sessionID string ) error {
134- path := "/command?id=" + url .QueryEscape (sessionID )
140+ params := url.Values {}
141+ params .Set ("id" , sessionID )
142+ path := "/command?" + params .Encode ()
135143 return e .client .doRequest (ctx , http .MethodDelete , path , nil , nil )
136144}
137145
@@ -207,7 +215,9 @@ func (e *ExecdClient) GetCommandLogs(ctx context.Context, commandID string, curs
207215// GetFileInfo retrieves metadata for the file at the given path.
208216func (e * ExecdClient ) GetFileInfo (ctx context.Context , path string ) (map [string ]FileInfo , error ) {
209217 var result map [string ]FileInfo
210- reqPath := "/files/info?path=" + url .QueryEscape (path )
218+ params := url.Values {}
219+ params .Set ("path" , path )
220+ reqPath := "/files/info?" + params .Encode ()
211221 err := e .client .doRequest (ctx , http .MethodGet , reqPath , nil , & result )
212222 return result , err
213223}
@@ -365,7 +375,9 @@ func (e *ExecdClient) newUploadFilesRequest(ctx context.Context, entries []Uploa
365375// returned io.ReadCloser. Pass rangeHeader (e.g. "bytes=0-1023") for partial
366376// content, or empty string for the full file.
367377func (e * ExecdClient ) DownloadFile (ctx context.Context , remotePath string , rangeHeader string ) (io.ReadCloser , error ) {
368- reqPath := "/files/download?path=" + url .QueryEscape (remotePath )
378+ params := url.Values {}
379+ params .Set ("path" , remotePath )
380+ reqPath := "/files/download?" + params .Encode ()
369381
370382 var resp * http.Response
371383 err := e .client .withRetry (ctx , func () error {
@@ -421,7 +433,9 @@ func OctalMode(m os.FileMode) int {
421433
422434// DeleteDirectory deletes a directory and all its contents recursively.
423435func (e * ExecdClient ) DeleteDirectory (ctx context.Context , path string ) error {
424- reqPath := "/directories?path=" + url .QueryEscape (path )
436+ params := url.Values {}
437+ params .Set ("path" , path )
438+ reqPath := "/directories?" + params .Encode ()
425439 return e .client .doRequest (ctx , http .MethodDelete , reqPath , nil , nil )
426440}
427441
0 commit comments