Fix fetcher client doesn't handle error properly (#1238)

This commit is contained in:
Ta-Ching Chen
2019-07-15 21:01:32 +08:00
committed by GitHub
parent 40e1689e49
commit 971a314d63
+5 -3
View File
@@ -5,13 +5,12 @@ import (
"context"
"encoding/json"
"io/ioutil"
"go.uber.org/zap"
"net/http"
"strings"
"time"
"go.uber.org/zap"
"go.opencensus.io/plugin/ochttp"
"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) {
body, err := sendRequest(c.logger, ctx, c.httpClient, fr, c.getUploadUrl())
if err != nil {
return nil, err
}
uploadResp := types.ArchiveUploadResponse{}
err = json.Unmarshal(body, &uploadResp)