mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-30 04:23:11 +03:00
Pages API: Made raw_html available on page responses
To provide a way to see the original un-pre-processed database HTML content. For #4310
This commit is contained in:
@ -159,6 +159,20 @@ class PagesApiTest extends TestCase
|
||||
$this->assertStringContainsString('testing', $html);
|
||||
}
|
||||
|
||||
public function test_read_endpoint_provides_raw_html()
|
||||
{
|
||||
$html = "<p>testing</p><script>alert('danger')</script><h1>Hello</h1>";
|
||||
|
||||
$this->actingAsApiEditor();
|
||||
$page = $this->entities->page();
|
||||
$page->html = $html;
|
||||
$page->save();
|
||||
|
||||
$resp = $this->getJson($this->baseEndpoint . "/{$page->id}");
|
||||
$this->assertEquals($html, $resp->json('raw_html'));
|
||||
$this->assertNotEquals($html, $resp->json('html'));
|
||||
}
|
||||
|
||||
public function test_read_endpoint_returns_not_found()
|
||||
{
|
||||
$this->actingAsApiEditor();
|
||||
|
Reference in New Issue
Block a user