Skip to content

Commit

Permalink
Add custom headers to generated doc
Browse files Browse the repository at this point in the history
  • Loading branch information
shalvah committed Oct 11, 2018
1 parent 2847da1 commit 73dee2b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
stopOnFailure="true">
<testsuites>
<testsuite name="Versionable Suite">
<directory>tests/</directory>
Expand Down
13 changes: 11 additions & 2 deletions resources/views/partials/route.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@

```bash
curl -X {{$parsedRoute['methods'][0]}} {{$parsedRoute['methods'][0] == 'GET' ? '-G ' : ''}}"{{ trim(config('app.docs_url') ?: config('app.url'), '/')}}/{{ ltrim($parsedRoute['uri'], '/') }}" \
-H "Accept: application/json"@if(count($parsedRoute['parameters'])) \
-H "Accept: application/json"@if(count($parsedRoute['headers'])) \
@foreach($parsedRoute['headers'] as $header => $value)
-H "{{$header}}"="{{$value}}" @if(! ($loop->last))\
@endif
@endforeach
@endif
@if(count($parsedRoute['parameters'])) \
@foreach($parsedRoute['parameters'] as $attribute => $parameter)
-d "{{$attribute}}"="{{$parameter['value']}}" @if(! ($loop->last))\
@endif
Expand All @@ -30,7 +36,10 @@
"data": {!! str_replace("\n}","\n }", str_replace(' ',' ',json_encode(array_combine(array_keys($parsedRoute['parameters']), array_map(function($param){ return $param['value']; },$parsedRoute['parameters'])), JSON_PRETTY_PRINT))) !!},
@endif
"headers": {
"accept": "application/json"
"accept": "application/json",
@foreach($parsedRoute['headers'] as $header => $value)
"{{$header}}": "{{$value}}",
@endforeach
}
}

Expand Down

0 comments on commit 73dee2b

Please sign in to comment.