1
0
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:
Dan Brown
2023-06-20 17:07:46 +01:00
parent 41c3ed154b
commit 8b935e71d1
6 changed files with 22 additions and 6 deletions

View File

@ -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();