Skip to content

Commit

Permalink
Fix code style
Browse files Browse the repository at this point in the history
  • Loading branch information
bastien-phi committed Aug 4, 2017
1 parent dda168d commit f178632
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/server/public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ function build_response($request)

$authorization = app('request')->server->get('PHP_AUTH_DIGEST');
if (!$authorization) {
return response(null,401)
return response(null, 401)
->header('WWW-Authenticate', 'Digest realm="' . $realm . '",qop="auth",nonce="' . uniqid() . '",opaque="' . md5($realm) . '"');
}

$data = ['nonce' => null, 'nc' => null, 'cnonce' => null, 'qop' => null, 'username' => null, 'uri' => null, 'response' => null];
foreach (array_keys($data) as $key) {
if (!preg_match("@$key=(?:\"(.*)\"|'(.*)'|(.*),)@U", $authorization, $matches)) {
return response(null,401);
return response(null, 401);
}
$data[$key] = array_values(array_filter($matches))[1];
}
Expand All @@ -84,19 +84,19 @@ function build_response($request)
$validResponse = md5($a . ':' . $data['nonce'] . ':' . $data['nc'] . ':'.$data['cnonce'] . ':' . $data['qop'] . ':' . $b);

if ($data['response'] != $validResponse) {
return response(null,401);
return response(null, 401);
}

return response(200);
});

$app->post('/multi-part', function () {
return response()->json([
'body_content' => app('request')->only(['foo', 'baz']),
'has_file' => app('request')->hasFile('test-file'),
'file_content' => file_get_contents($_FILES['test-file']['tmp_name']),
'headers' => app('request')->header(),
], 200);
'body_content' => app('request')->only(['foo', 'baz']),
'has_file' => app('request')->hasFile('test-file'),
'file_content' => file_get_contents($_FILES['test-file']['tmp_name']),
'headers' => app('request')->header(),
], 200);
});

$app->run();

0 comments on commit f178632

Please sign in to comment.