okigan / awscurl

curl-like access to AWS resources with AWS Signature Version 4 request signing.
MIT License
769 stars 94 forks source link

Incorrect exit code when the HTTP response is failure #208

Closed jackie-linz closed 2 months ago

jackie-linz commented 2 months ago

I have a lambda function with function URL that returns status code of 400

export const handler = async (event) => {
  return  {
    statusCode: 400,
    body: JSON.stringify({data: 'Hello from Lambda!'}),
  };
};

I call this function with awscurl and I'd expect that the command exit with non-zero exit code, but got zero instead.

$ awscurl --service lambda https://<my-function-url>.lambda-url.ap-southeast-2.on.aws/
{"data":"Hello from Lambda!"}
$ echo $?
0

Looks like this line of code is missing a return?

https://github.com/okigan/awscurl/blob/master/awscurl/awscurl.py#L573