Skip to content

Commit

Permalink
Address old @adam-vessey comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
ruebot committed Aug 25, 2023
1 parent e524024 commit 92a6484
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
15 changes: 10 additions & 5 deletions src/IIIFManifestParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,16 @@ public function getTileSources($manifest_url, $access_token = NULL) {

try {
// Request the manifest.
$manifest_response = $this->httpClient->request('GET', $manifest_url, [
'headers' => [
'Authorization' => 'Bearer ' . $access_token,
],
]);
if (empty($access_token)) {
$manifest_response = $this->httpClient->get($manifest_url);
}
else {
$manifest_response = $this->httpClient->request('GET', $manifest_url, [
'headers' => [
'Authorization' => 'Bearer ' . $access_token,
],
]);
}

// Decode the manifest json.
$manifest_string = (string) $manifest_response->getBody();
Expand Down
4 changes: 1 addition & 3 deletions tests/src/Kernel/IIIFManifestParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,7 @@ public function testGetTileSourcesWithTokens() {
$logger
);

$access_token = 'islandora';

$tile_sources = $parser->getTileSources('http://example.org/node/[node:nid]/manifest', $access_token);
$tile_sources = $parser->getTileSources('http://example.org/node/[node:nid]/manifest');
$expected = [
'http://127.0.0.1:8080/cantaloupe/iiif/2/derp.TIF',
'http://127.0.0.1:8080/cantaloupe/iiif/2/derp.jpeg',
Expand Down

0 comments on commit 92a6484

Please sign in to comment.