Skip to content

Commit d8e8c6a

Browse files
author
Dana H. P'Simer, Jr
committed
bodyReader is now an io.Reader, fixed package in Makefile
1 parent b4654bd commit d8e8c6a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

examples/helloWorld/lambda/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ pack:
1313
dbuild:
1414
@docker run --rm \
1515
-v $(GOPATH):/go \
16-
-w /go/src/github.com/danapsimer/aws-lambda-shim/examples/helloWorld/lambda \
16+
-w /go/src/github.com/danapsimer/aws-api-to-lambda-shim/examples/helloWorld/lambda \
1717
eawsy/aws-lambda-go make build
1818

1919
dpack:
2020
@docker run --rm \
2121
-v $(GOPATH):/go \
22-
-w /go/src/github.com/danapsimer/aws-lambda-shim/examples/helloWorld/lambda \
22+
-w /go/src/github.com/danapsimer/aws-api-to-lambda-shim/examples/helloWorld/lambda \
2323
eawsy/aws-lambda-go make pack
2424

2525
clean:

shim/shim.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"encoding/json"
66
"fmt"
77
"github.com/eawsy/aws-lambda-go/service/lambda/runtime"
8+
"io"
89
"io/ioutil"
910
"log"
1011
"net/http"
@@ -169,9 +170,10 @@ func (shim *HttpHandlerShim) handle(evt json.RawMessage, ctx *runtime.Context) (
169170
log.Printf("ERROR: %s", err.Error())
170171
return apiGatewayResponse{StatusCode: 500, Body: err.Error()}, nil
171172
}
172-
bodyReader := strings.NewReader(msg.Body)
173+
var bodyReader io.Reader
174+
bodyReader = strings.NewReader(msg.Body)
173175
if msg.IsBase64Encoded {
174-
bodyReader = base64.NewDecoder(base64.StdEncoding,bodyReader)
176+
bodyReader = base64.NewDecoder(base64.StdEncoding, bodyReader)
175177
}
176178
//log.Printf("url parsed: %v", url)
177179
httpRequest := http.Request{

0 commit comments

Comments
 (0)