Skip to content

Commit

Permalink
Adding isJson() and wantsJson() to Request
Browse files Browse the repository at this point in the history
Needs to be documented.
  • Loading branch information
JesseObrien committed Jan 10, 2014
1 parent 7c5df2c commit e3c589e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions requests.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,16 +168,23 @@ The `Request` class provides many methods for examining the HTTP request for you

$value = Request::server('PATH_INFO');

#### Determining If The Request Is Over HTTPS

if (Request::secure())
{
//
}

#### Determine If The Request Is Using AJAX

if (Request::ajax())
{
//
}

#### Determining If The Request Is Over HTTPS
#### Detect any type of JSON request

if (Request::secure())
if (Request::ajax() or Request::isJson() or Request::wantsJson())
{
//
}
Expand All @@ -189,4 +196,4 @@ The `Request::format` method will return the requested response format based on
if (Request::format() == 'json')
{
//
}
}

0 comments on commit e3c589e

Please sign in to comment.