mirror of
https://github.com/ambieco/scribe.git
synced 2026-04-30 10:52:56 +08:00
Fix issues with rendering example requests
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user