Fix fetcher client doesn't handle error properly (#1238)
This commit is contained in:
@@ -5,13 +5,12 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
|
||||||
"go.uber.org/zap"
|
|
||||||
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"go.uber.org/zap"
|
||||||
|
|
||||||
"go.opencensus.io/plugin/ochttp"
|
"go.opencensus.io/plugin/ochttp"
|
||||||
"golang.org/x/net/context/ctxhttp"
|
"golang.org/x/net/context/ctxhttp"
|
||||||
|
|
||||||
@@ -61,6 +60,9 @@ func (c *Client) Fetch(ctx context.Context, fr *types.FunctionFetchRequest) erro
|
|||||||
|
|
||||||
func (c *Client) Upload(ctx context.Context, fr *types.ArchiveUploadRequest) (*types.ArchiveUploadResponse, error) {
|
func (c *Client) Upload(ctx context.Context, fr *types.ArchiveUploadRequest) (*types.ArchiveUploadResponse, error) {
|
||||||
body, err := sendRequest(c.logger, ctx, c.httpClient, fr, c.getUploadUrl())
|
body, err := sendRequest(c.logger, ctx, c.httpClient, fr, c.getUploadUrl())
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
uploadResp := types.ArchiveUploadResponse{}
|
uploadResp := types.ArchiveUploadResponse{}
|
||||||
err = json.Unmarshal(body, &uploadResp)
|
err = json.Unmarshal(body, &uploadResp)
|
||||||
|
|||||||
Reference in New Issue
Block a user