Default to raw response for curl
This commit is contained in:
parent
7e49b37fb8
commit
06a85be7da
|
@ -50,7 +50,16 @@ class PasteController extends Controller
|
||||||
|
|
||||||
public function view(Request $request, Paste $paste)
|
public function view(Request $request, Paste $paste)
|
||||||
{
|
{
|
||||||
$format = $request->input('format', 'html'); //TODO: Use HTTP content negotiation for the default format
|
//TODO: Use HTTP content negotiation for the default format
|
||||||
|
$userAgent = $request->header('User-Agent');
|
||||||
|
if(substr($userAgent, 0, 4) == 'curl')
|
||||||
|
{
|
||||||
|
$format = $request->input('format', 'raw'); //default to raw format for curl
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$format = $request->input('format', 'html'); //default to html format for other user agents
|
||||||
|
}
|
||||||
|
|
||||||
switch($format)
|
switch($format)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue