Reputation: 67
In laravel 5.8 my swagger documentation is displaying fine but when I enter execute then its coming with 'Could not render n, see the console.' error.
composer.php
"darkaonline/l5-swagger": "5.8.*"
what can be the reason? anyone please suggest. TIA
Upvotes: 0
Views: 5746
Reputation: 67
you can make it okey by passing the request through that functions.
requestInterceptor: function(request) {
request.headers['X-CSRF-TOKEN'] = '{{ csrf_token() }}';
return request;
}
Upvotes: 2
Reputation: 44
I just had a similar issue but with Laravel 7.26.x. Issue related to the CSRF Token.
On my swagger blade I removed from the body
requestInterceptor: function () {
this.headers['X-CSRF-TOKEN'] = '{{ csrf_token() }}';
return this;
},
and added instead
<meta name="csrf-token" content="{{ csrf_token() }}">
Also don't forget to add in your web routes
Route::group(['middleware' => 'web'], function () {
Route::get('api/documentation', '\L5Swagger\Http\Controllers\SwaggerController@api')->name('l5swagger.api');
});
Upvotes: 1