aws-api-gateway-cli-test icon indicating copy to clipboard operation
aws-api-gateway-cli-test copied to clipboard

Possible to get output to print out deep nested objects?

Open Guitarkalle opened this issue 7 years ago • 9 comments

Is there anyway for the CLI to output the entire response including deeply nested objects?

Now the output becomes, for example: requestContext: [Object]

Guitarkalle avatar Apr 02 '18 19:04 Guitarkalle

@Guitarkalle There isn't right now. It's just meant to test if the request was successful or not. Are you using it to debug your output?

jayair avatar Apr 02 '18 21:04 jayair

@jayair Not often but it would be really helpful if it was possible to supply an option to do it :)

Guitarkalle avatar Apr 04 '18 09:04 Guitarkalle

@Guitarkalle I see. Can I see a sample of the full output you are seeing right now?

jayair avatar Apr 04 '18 19:04 jayair

@jayair So here I can't see the headers for instance :)

Authenticating with User Pool
Getting temporary credentials
Making API request
{ status: 200,
  statusText: 'OK',
  data:
   { message: 'Getting data!',
     input:
      { resource: '/getdata',
        path: '/getdata',
        httpMethod: 'GET',
        headers: [Object],
        queryStringParameters: null,
        pathParameters: null,
        stageVariables: null,
        requestContext: [Object],
        body: null,
        isBase64Encoded: false },
     data: [ [Object] ] } }

Guitarkalle avatar Apr 08 '18 13:04 Guitarkalle

@Guitarkalle That makes sense. This should be easy to fix. In these two instances:

  • https://github.com/AnomalyInnovations/aws-api-gateway-cli-test/blob/master/index.js#L179
  • https://github.com/AnomalyInnovations/aws-api-gateway-cli-test/blob/master/index.js#L187

We need to pass in a second argument of null to the console.dir() call (https://nodejs.org/api/console.html#console_console_dir_obj_options).

Do you want to try it and submit a PR?

jayair avatar Apr 09 '18 17:04 jayair

@jayair Sure, give me a few days and I can find some time to look at it:)

Guitarkalle avatar Apr 09 '18 17:04 Guitarkalle

I fixed and created a PR for it

bveenvliet avatar Dec 11 '18 15:12 bveenvliet

@bveenvliet That's awesome! Thanks!

jayair avatar Dec 18 '18 00:12 jayair