response - Laravel 5 - Deal with controller validation and RESTful clients like Postman -


i using laravel's restful resource routes , controllers.
testing api postman and/or restclient(firefox)

everything fine before added laravel's controller validation. respond strange responses like: status code 0, or executes code not valid data. or shows strange results taken database (which not included controller @ all).

that's creepy.

for example:

public function store(request $request) {     $this->validate($request, [         'room_id' => 'required|integer',         'body' => 'required'     ]);      exit; // stop process after validation...      // ... logic store message in database ...     return response(null, 204); } 

this store function must only validate data , respond error if validation fails,
but when execute postman, returns response list of rooms belongs user. creepy, cannot realize why happening.

when use jquery.ajax() method same request options, works fine. validates data , stores message in database.

question : there way deal postman?
question : postman dangerous? since server respond database info (which not included controller responses).

if take closer @ laravel's validation document says when data submitted via html form,the validate method redirect previous page , error flashed session, if validation fails. although, able access these error messages in view using $error variable. therefore need submit data via ajax in-order json error message.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -