From cedae88b67e5a3940063536600d9bda20cf38f8c Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Fri, 17 Jan 2014 15:38:43 +0000 Subject: [PATCH] Add OTP token to the request headers --- src/Composer/Util/GitHub.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Composer/Util/GitHub.php b/src/Composer/Util/GitHub.php index e3185745d..41fe63740 100644 --- a/src/Composer/Util/GitHub.php +++ b/src/Composer/Util/GitHub.php @@ -101,11 +101,17 @@ class GitHub $appName .= ' on ' . trim($output); } + $headers = array('Content-Type: application/json'); + + if ($otp) { + $headers[] = 'X-GitHub-OTP: ' . $otp; + } + $contents = JsonFile::parseJson($this->remoteFilesystem->getContents($originUrl, 'https://'. $apiUrl . '/authorizations', false, array( 'http' => array( 'method' => 'POST', 'follow_location' => false, - 'header' => "Content-Type: application/json\r\n", + 'header' => $headers, 'content' => json_encode(array( 'scopes' => array('repo'), 'note' => $appName,