Skip to content

Commit

Permalink
Merge pull request #12 from Thorleon/use-none-logtype-for-lambda-invoke
Browse files Browse the repository at this point in the history
Use None LogType for Lambda invoke
  • Loading branch information
kpacha committed Nov 14, 2022
2 parents e08cd7e + b797dbc commit 70c7a2f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
6 changes: 3 additions & 3 deletions backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"encoding/base64"
"encoding/json"
"errors"
"io/ioutil"
"io"
"strings"

"github.com/aws/aws-sdk-go/aws"
Expand Down Expand Up @@ -71,7 +71,7 @@ func BackendFactoryWithInvoker(logger logging.Logger, bf proxy.BackendFactory, i
// ClientContext: aws.String(clientContext),
FunctionName: aws.String(ecfg.FunctionExtractor(r)),
InvocationType: aws.String("RequestResponse"),
LogType: aws.String("Tail"),
LogType: aws.String("None"),
Payload: payload,
// Qualifier: aws.String("1"),
}
Expand Down Expand Up @@ -182,5 +182,5 @@ func fromParams(r *proxy.Request) ([]byte, error) {
}

func fromBody(r *proxy.Request) ([]byte, error) {
return ioutil.ReadAll(r.Body)
return io.ReadAll(r.Body)
}
9 changes: 4 additions & 5 deletions test/localstack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"context"
"flag"
"io"
"io/ioutil"
"os"
"testing"
"time"
Expand Down Expand Up @@ -49,7 +48,7 @@ func TestLocalStack(t *testing.T) {
Name: "post_with_default_key",
Method: "POST",
Params: map[string]string{"function": "python37"},
Body: ioutil.NopCloser(bytes.NewBufferString(`{"first_name":"foobar","last_name":"some"}`)),
Body: io.NopCloser(bytes.NewBufferString(`{"first_name":"foobar","last_name":"some"}`)),
ExpectedMsg: "Hello foobar some!",
},
{
Expand All @@ -63,7 +62,7 @@ func TestLocalStack(t *testing.T) {
Name: "post_with_custom_key",
Method: "POST",
Params: map[string]string{"function": "unknown", "lambda": "python37"},
Body: ioutil.NopCloser(bytes.NewBufferString(`{"first_name":"foobar","last_name":"some"}`)),
Body: io.NopCloser(bytes.NewBufferString(`{"first_name":"foobar","last_name":"some"}`)),
Key: "lambda",
ExpectedMsg: "Hello foobar some!",
},
Expand All @@ -78,7 +77,7 @@ func TestLocalStack(t *testing.T) {
Name: "post_with_function_name",
Method: "POST",
Params: map[string]string{"function": "unknown"},
Body: ioutil.NopCloser(bytes.NewBufferString(`{"first_name":"foobar","last_name":"some"}`)),
Body: io.NopCloser(bytes.NewBufferString(`{"first_name":"foobar","last_name":"some"}`)),
ExpectedMsg: "Hello foobar some!",
Function: "python37",
},
Expand All @@ -94,7 +93,7 @@ func TestLocalStack(t *testing.T) {
Name: "post_with_function_name_and_key",
Method: "POST",
Params: map[string]string{"function": "unknown", "lambda": "unknown"},
Body: ioutil.NopCloser(bytes.NewBufferString(`{"first_name":"foobar","last_name":"some"}`)),
Body: io.NopCloser(bytes.NewBufferString(`{"first_name":"foobar","last_name":"some"}`)),
Key: "lambda",
ExpectedMsg: "Hello foobar some!",
Function: "python37",
Expand Down

0 comments on commit 70c7a2f

Please sign in to comment.