Skip to content

Commit d2ebc0b

Browse files
committed
Return byte slice for non-json responses
1 parent 8612b0d commit d2ebc0b

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

src/SDK/Language/Go.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ protected function getReturnType(array $method, array $spec, string $namespace,
302302
return 'bool';
303303
}
304304
if ($method['type'] === 'location') {
305-
return 'string';
305+
return '[]byte';
306306
}
307307

308308
if (

templates/go/client.go.twig

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -378,21 +378,18 @@ func (clt *Client) Call(method string, path string, headers map[string]interface
378378
Type: contentType,
379379
}, nil
380380
}
381-
output, err := getOutput(params, fileNameKey, responseData, contentType)
382-
if err != nil {
383-
return nil, err
384-
}
381+
385382
if resp.StatusCode < 200 || resp.StatusCode > 399 {
386383
return nil, &{{ spec.title | caseUcfirst }}Error{
387384
statusCode: resp.StatusCode,
388-
message: output,
385+
message: string(responseData),
389386
}
390387
}
391388
return &ClientResponse{
392389
Status: resp.Status,
393390
StatusCode: resp.StatusCode,
394391
Header: resp.Header,
395-
Result: output,
392+
Result: responseData,
396393
Type: contentType,
397394
}, nil
398395
}

tests/languages/go/tests.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ func testGeneralDownload(client client.Client) {
169169
if err != nil {
170170
fmt.Printf("general.Download => error %v", err)
171171
}
172-
fmt.Printf("%v\n", *response)
172+
fmt.Printf("%s\n", string(*response))
173173
}
174174

175175
func testLargeUpload(client client.Client, stringInArray []interface{}) {

0 commit comments

Comments
 (0)