Skip to content

Commit 3119fbd

Browse files
committed
Only add the draft header on live preview requests. Closes #1376
1 parent 6e209b3 commit 3119fbd

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Http/Responses/DataResponse.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ protected function handleDraft()
113113
throw new NotFoundHttpException;
114114
}
115115

116-
$this->headers['X-Statamic-Draft'] = true;
116+
if ($this->isLivePreview()) {
117+
$this->headers['X-Statamic-Draft'] = true;
118+
}
117119

118120
return $this;
119121
}

tests/FrontendTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ function page_is_displayed()
4545
]
4646
]);
4747

48-
$response = $this->get('/about')->assertStatus(200);
48+
$response = $this->get('/about')
49+
->assertStatus(200)
50+
->assertHeaderMissing('X-Statamic-Draft');
4951

5052
$this->assertEquals('<h1>The About Page</h1> <p>This is the about page.</p>', trim($response->content()));
5153
}

0 commit comments

Comments
 (0)