Skip to content

Commit

Permalink
fix: better output rendering for JSON responses in call command
Browse files Browse the repository at this point in the history
  • Loading branch information
edvald committed May 14, 2018
1 parent b763716 commit 1aecfe0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/commands/call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import { resolve } from "url"
import Axios from "axios"
import chalk from "chalk"
import { isObject } from "util"
import { Command, ParameterValues, StringParameter } from "./base"
import { splitFirst } from "../util"
import { ParameterError, RuntimeError } from "../exceptions"
Expand Down Expand Up @@ -113,7 +114,9 @@ export class CallCommand extends Command<typeof callArgs> {
ctx.log.info(chalk.red(`\n${res.status} ${res.statusText}\n`))
}

res.data && ctx.log.info(chalk.white(res.data))
const resStr = isObject(res.data) ? JSON.stringify(res.data, null, 2) : res.data

res.data && ctx.log.info(chalk.white(resStr))

return {
serviceName,
Expand Down

0 comments on commit 1aecfe0

Please sign in to comment.