Skip to content

Commit d3c6e4a

Browse files
Merge pull request #100 from hommingcom/master
Fix id navigation and add quality-of-life configuration options
2 parents b8bef51 + 92fd95f commit d3c6e4a

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

config/request-docs.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,20 @@
1616
// \App\Http\Middleware\NotFoundWhenProduction::class,
1717
],
1818

19+
/*
20+
* Default headers shown on the request headers editor
21+
*/
22+
'default_request_headers' => [
23+
'Accept' => 'application/json',
24+
'X-CSRF-TOKEN' => '',
25+
'Authorization' => 'Bearer',
26+
],
27+
28+
/*
29+
* Show development relevant metadata on endpoints
30+
*/
31+
'show_development_metadata' => true,
32+
1933
/**
2034
* Path to to static HTML if using command line.
2135
*/

resources/views/index.blade.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,11 @@ class="inline-flex text-xs"
212212
{{$doc['methods'][0]}}
213213
</span>
214214
<span class="">
215-
<a href="#{{$doc['uri']}}">{{$doc['uri']}}</a>
215+
<a href="#{{$doc['httpMethod'] .'-'. $doc['uri']}}">{{$doc['uri']}}</a>
216216
</span>
217217
</h1>
218218
</div>
219+
@if (config('request-docs.show_development_metadata'))
219220
<table class="table-fixed text-sm mt-5">
220221
<tbody>
221222
<tr>
@@ -244,6 +245,7 @@ class="inline-flex text-xs"
244245
@endforeach
245246
</tbody>
246247
</table>
248+
@endif
247249
<div v-if="docs[{{$index}}]['docBlock']" class="border-2 mr-4 mt-4 p-4 rounded text-sm">
248250
<h3 class="font-bold">Description</h3>
249251
<hr>
@@ -660,9 +662,7 @@ class="my-prism-editor"
660662
filterTerm: ''
661663
},
662664
created: function () {
663-
axios.defaults.headers.common['X-CSRF-TOKEN'] = document.querySelector('meta[name="csrf-token"]').getAttribute('content'),
664-
axios.defaults.headers.common['Authorization'] = 'Bearer '
665-
this.requestHeaders = JSON.stringify(axios.defaults.headers.common, null, 2)
665+
this.requestHeaders = JSON.stringify({!! json_encode(config('request-docs.default_request_headers')) !!}, null, 2)
666666
},
667667
methods: {
668668
highlightSidebar(idx) {

0 commit comments

Comments
 (0)