serverless-apigw-binary icon indicating copy to clipboard operation
serverless-apigw-binary copied to clipboard

sls invoke returns gzip(base64(json))

Open mvayngrib opened this issue 8 years ago • 3 comments

for now i'm using the below script to invoke + decode the response data:

invoke script:

#!/bin/sh

RESP=$(sls invoke $@)
STATUS=$(echo $RESP | jq .statusCode --raw-output)
if [ "$STATUS" == "200" ]; then
  echo $RESP | jq .body --raw-output | base64 --decode | gunzip | jq
else
  echo $RESP | jq
fi

then i run: ./invoke --path ./path/to/event.json -f function_name

would you want to handle the decoding internally, maybe by looking for a custom flag to invoke, e.g. --compressed (a la curl)?

mvayngrib avatar Oct 01 '17 17:10 mvayngrib

Sounds interesting. Would you like to participate in this enhancement?

maciejtreder avatar Oct 03 '17 11:10 maciejtreder

@maciejtreder i would! However, i'm afraid i won't be able to in the short term, I'm already overcommitted, so if you or someone else wants to implement this, don't wait for me. Also, thanks for the plugin :)

mvayngrib avatar Oct 08 '17 02:10 mvayngrib

@mvayngrib Same with me (regarding backlog of things to do). So, no worries. Start when you will be able to and there won't be such fix yet :)

Thanks in advance!

maciejtreder avatar Oct 11 '17 21:10 maciejtreder