Fix issues with rendering example requests

This commit is contained in:
shalvah
2018-10-26 08:46:49 +01:00
parent b7aedfda0b
commit 8628be4c12
4 changed files with 26 additions and 18 deletions

View File

@@ -18,20 +18,17 @@
> Example request:
```bash
curl -X {{$route['methods'][0]}} {{$route['methods'][0] == 'GET' ? '-G ' : ''}}"{{ trim(config('app.docs_url') ?: config('app.url'), '/')}}/{{ ltrim($route['uri'], '/') }}" \
-H "Accept: application/json"@if(count($route['headers'])) \
curl -X {{$route['methods'][0]}} {{$route['methods'][0] == 'GET' ? '-G ' : ''}}"{{ trim(config('app.docs_url') ?: config('app.url'), '/')}}/{{ ltrim($route['uri'], '/') }}" @if(count($route['headers']))\
@foreach($route['headers'] as $header => $value)
-H "{{$header}}: {{$value}}" @if(! ($loop->last))\
@endif
-H "{{$header}}: {{$value}}"@if(! ($loop->last) || ($loop->last && count($route['bodyParameters']))) \
@endif
@endforeach
@endif
@if(count($route['bodyParameters'])) \
@foreach($route['bodyParameters'] as $attribute => $parameter)
-d "{{$attribute}}"="{{$parameter['value']}}" @if(! ($loop->last))\
@endif
@endforeach
@endif
@endforeach
```
```javascript
@@ -44,7 +41,6 @@ var settings = {
"data": {!! str_replace("\n}","\n }", str_replace(' ',' ',json_encode(array_combine(array_keys($route['bodyParameters']), array_map(function($param){ return $param['value']; },$route['bodyParameters'])), JSON_PRETTY_PRINT))) !!},
@endif
"headers": {
"accept": "application/json",
@foreach($route['headers'] as $header => $value)
"{{$header}}": "{{$value}}",
@endforeach