Example #1
0
function test($request, $expected = null)
{
    global $client;
    $result = '';
    $response = $client->rawcall($request);
    if ($expected !== null) {
        $expected = json_encode(json_decode($expected));
    }
    $result .= '--> ' . $request . "\r\n";
    if ($response !== null) {
        $result .= '<-- ' . json_prettify($response) . "\r\n";
    }
    if ($response === $expected) {
        $result .= '<strong class="pass">Pass</strong>';
    } else {
        $result .= '<strong class="fail">Fail</strong> (expecting ' . $expected . ')';
    }
    return $result;
}
Example #2
0
		border: 0px;
	}
</style>
<script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script>
<?php 
echo "<body class='S{$response['http_code']}'>\n";
echo "<h1>{$method} {$response['url']}</h1>\n";
echo "<p><a href='index.php'>Return to Main Screen</a></p>\n";
// REQUEST
echo "<h2>Request</h2>\n";
echo "<pre>{$debug['headers_sent']}</pre>\n";
echo "<pre>{$body_prefix}RAW_FILE_CONTENTS{$body_postfix}</pre>\n";
echo "<hr />\n";
// RESPONSE
echo "<h2>Response</h2>\n";
echo "<pre>{$response['headers_recv']}</pre>\n";
if (!$response_body) {
    echo "<div><em>&lt;empty body&gt;</em></div>\n";
} else {
    if ($body_decoded = @json_decode($response_body)) {
        echo "<pre class='prettyprint'><code class='language-javascript'>" . json_prettify($response_body) . "</code></pre>\n";
    } else {
        echo "<pre>" . htmlentities($response_body) . "</pre>\n";
    }
}
if ($additional_errors) {
    echo "<hr />\n";
    echo "<h2>Additional OAuth Client Errors</h2>\n";
    echo "<pre>{$additional_errors}</pre>\n";
}
echo "</body>\n";