Remove shield for Conduit API responses
Summary: 'cuz we don't need it and it's lame complexity for API clients of all kinds. Rip the band-aid off now. Test Plan: used conduit console and verified no more shield. also did some JS stuff around the suite to verify I didn't kill JS Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T891 Differential Revision: https://secure.phabricator.com/D3265
This commit is contained in:
@@ -22,15 +22,31 @@
|
||||
final class AphrontJSONResponse extends AphrontResponse {
|
||||
|
||||
private $content;
|
||||
private $addJSONShield;
|
||||
|
||||
public function setContent($content) {
|
||||
$this->content = $content;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setAddJSONShield($should_add) {
|
||||
$this->addJSONShield = $should_add;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function shouldAddJSONShield() {
|
||||
if ($this->addJSONShield === null) {
|
||||
return true;
|
||||
}
|
||||
return (bool) $this->addJSONShield;
|
||||
}
|
||||
|
||||
public function buildResponseString() {
|
||||
$response = $this->encodeJSONForHTTPResponse($this->content);
|
||||
return $this->addJSONShield($response, $use_javelin_shield = false);
|
||||
if ($this->shouldAddJSONShield()) {
|
||||
$response = $this->addJSONShield($response, $use_javelin_shield = false);
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function getHeaders() {
|
||||
@@ -40,5 +56,4 @@ final class AphrontJSONResponse extends AphrontResponse {
|
||||
$headers = array_merge(parent::getHeaders(), $headers);
|
||||
return $headers;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user