Skip to content

Commit

Permalink
fix some bugs (#414)
Browse files Browse the repository at this point in the history
  • Loading branch information
yangzong18 authored and huiguangjun committed Oct 30, 2023
1 parent cf6ec90 commit 85d6790
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
4 changes: 2 additions & 2 deletions oss/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package oss
import (
"encoding/xml"
"fmt"
"io"
"io/ioutil"
"net/http"
"strconv"
"strings"
Expand Down Expand Up @@ -78,7 +78,7 @@ func CheckCallbackResp(resp *Response) error {
contentLength, _ := strconv.Atoi(contentLengthStr)
var bodyBytes []byte
if contentLength > 0 {
bodyBytes, _ = io.ReadAll(resp.Body)
bodyBytes, _ = ioutil.ReadAll(resp.Body)
}
if len(bodyBytes) > 0 {
srvErr, errIn := serviceErrFromXML(bodyBytes, resp.StatusCode,
Expand Down
3 changes: 0 additions & 3 deletions oss/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package oss
import (
"context"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
Expand Down Expand Up @@ -715,8 +714,6 @@ func GetCallbackBody(options []Option, resp *Response, callbackSet bool) error {
callback, _ := FindOption(options, HTTPHeaderOssCallback, nil)
if callback != nil {
err = setBody(options, resp)
}else{
io.Copy(io.Discard, resp.Body)
}
}
return err
Expand Down
4 changes: 2 additions & 2 deletions sample/describe_regions.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func DescribeRegionsSample() {

// Get describe regions
regionEndpoint := "oss-cn-hangzhou"
list, err := client.DescribeRegions(regionEndpoint)
list, err := client.DescribeRegions(oss.AddParam("regions", regionEndpoint))
if err != nil {
HandleError(err)
}
Expand All @@ -29,7 +29,7 @@ func DescribeRegionsSample() {

// List describe regions

list, err = client.DescribeRegions("")
list, err = client.DescribeRegions()
if err != nil {
HandleError(err)
}
Expand Down

0 comments on commit 85d6790

Please sign in to comment.