From 2cac303c428e245d16f606b099a64b4fbb08b080 Mon Sep 17 00:00:00 2001 From: Seth House Date: Wed, 1 Apr 2015 15:16:26 -0600 Subject: [PATCH] Don't try to guess whether to use GET or POST Testing this via [ -t ] does not fully work since subshells inherit the file descriptor target. There may still be a way to detect this (perhaps by reading a byte from stdin to see if it's empty or not). I'll revisit this later if I still care. :-) Thanks to lhunath in #bash for the help. --- octokit.sh | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/octokit.sh b/octokit.sh index e4d126e..a4cb7a9 100755 --- a/octokit.sh +++ b/octokit.sh @@ -284,25 +284,20 @@ request() { # # Keyword arguments # - # method : GET or POST + local method='GET' # The method to use for the HTTP request. - # If data is passed to this function via stdin, 'POST' will be used as - # the default instead of 'GET'. local content_type='application/json' # The value of the Content-Type header to use for the request. shift 1 - local method cmd arg has_stdin trace_curl + local cmd arg has_stdin trace_curl case $path in (http*) : ;; *) path="${OCTOKIT_SH_URL}${path}" ;; esac - method='GET' - [ ! -t 0 ] && method='POST' - for arg in "$@"; do case $arg in (method=*) method="${arg#*=}";;