Skip to content

Commit 92a6484

Browse files
committed
Address old @adam-vessey comment.
1 parent e524024 commit 92a6484

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

src/IIIFManifestParser.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,16 @@ public function getTileSources($manifest_url, $access_token = NULL) {
8787

8888
try {
8989
// Request the manifest.
90-
$manifest_response = $this->httpClient->request('GET', $manifest_url, [
91-
'headers' => [
92-
'Authorization' => 'Bearer ' . $access_token,
93-
],
94-
]);
90+
if (empty($access_token)) {
91+
$manifest_response = $this->httpClient->get($manifest_url);
92+
}
93+
else {
94+
$manifest_response = $this->httpClient->request('GET', $manifest_url, [
95+
'headers' => [
96+
'Authorization' => 'Bearer ' . $access_token,
97+
],
98+
]);
99+
}
95100

96101
// Decode the manifest json.
97102
$manifest_string = (string) $manifest_response->getBody();

tests/src/Kernel/IIIFManifestParserTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,7 @@ public function testGetTileSourcesWithTokens() {
210210
$logger
211211
);
212212

213-
$access_token = 'islandora';
214-
215-
$tile_sources = $parser->getTileSources('http://example.org/node/[node:nid]/manifest', $access_token);
213+
$tile_sources = $parser->getTileSources('http://example.org/node/[node:nid]/manifest');
216214
$expected = [
217215
'http://127.0.0.1:8080/cantaloupe/iiif/2/derp.TIF',
218216
'http://127.0.0.1:8080/cantaloupe/iiif/2/derp.jpeg',

0 commit comments

Comments
 (0)