Fix HTTP headers

This commit is contained in:
Pig Fang 2018-08-12 08:48:42 +08:00
parent 5778605417
commit fea37bc512
2 changed files with 2 additions and 1 deletions

View File

@ -62,7 +62,7 @@ class Handler extends ExceptionHandler
if ($e instanceof ValidationException) {
// Quick fix for returning 422
// @see https://prinzeugen.net/custom-responses-of-laravel-validations/
if ($request->expectsJson() || $request->ajax()) {
if ($request->expectsJson()) {
return response()->json([
'errno' => 1,
'msg' => $e->validator->errors()->first()

View File

@ -5,6 +5,7 @@ const empty = Object.create(null);
const init = {
credentials: 'same-origin',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
};