2

I have this in my laravel ctrl "Posts" :

public function index() {
    $posts = Post::get();
    if (Request::isJson()) {
        return $posts;
    }
    return View::make('posts.index', compact('posts'));
}

When i got it via a browser, it's the human view, but with postman (http://www.getpostman.com/) it's the human view too ! So, when i put only the json view, i have it. It's not the normal behavior of postman to get the human view, isn'it ?

ScottS
  • 8,455
  • 3
  • 30
  • 50
zelocalhost
  • 1,175
  • 3
  • 20
  • 39

1 Answers1

7

By default postman will include an

Accept: */*

header.

If you specifically want json you should send an

Accept: application/json

header.

ScottS
  • 8,455
  • 3
  • 30
  • 50