Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Json strategy should only be matched for application/json and applica…
Browse files Browse the repository at this point in the history
…tion/javascript
  • Loading branch information
SocalNick committed Jul 19, 2012
7 parents e3b1be1 + 19f0ef6 + 33bf9c0 + 3729984 + a5ce396 + 698dbe0 + 0efca0b commit c6ef70d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/Strategy/JsonStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,18 @@ public function selectRenderer(ViewEvent $e)
return;
}

if ($match->getFormat() == 'json') {
if ($match->getTypeString() == 'application/json') {
// application/json Accept header found
return $this->renderer;
}

// application/javascript Accept header found
if (false != ($callback = $request->getQuery()->get('callback'))) {
$this->renderer->setJsonpCallback($callback);
if ($match->getTypeString() == 'application/javascript') {
// application/javascript Accept header found
if (false != ($callback = $request->getQuery()->get('callback'))) {
$this->renderer->setJsonpCallback($callback);
}
return $this->renderer;
}

return $this->renderer;
}

/**
Expand Down

0 comments on commit c6ef70d

Please sign in to comment.