Skip to content

Commit 968922f

Browse files
Merge pull request #167 from rakutentech/feature/sanctum
(v2.9) allow empty json responses
2 parents d10f289 + 01ca903 commit 968922f

File tree

4 files changed

+20
-12
lines changed

4 files changed

+20
-12
lines changed

README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,9 @@ Fixing lints
195195
- v2.8 Show full activity on Eloquent models
196196

197197

198-
# Maintainers
198+
# Contributors
199199

200-
<table>
201-
<tr>
202-
<td align="center"><a href="https://kevincobain2000.github.io"><img src="https://avatars2.githubusercontent.com/u/629055?v=4" width="100px;" alt=""/><br /><sub><b>Pulkit Kathuria</b></sub></a><br /><a href="https://github.com/kevincobain2000/laravel-alert-notifications/pulls?q=is%3Apr+reviewed-by%3Akevincobain2000" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/kevincobain2000/laravel-alert-notifications/commits?author=kevincobain2000" title="Tests">⚠️</a> <a href="https://github.com/kevincobain2000/laravel-alert-notifications/commits?author=kevincobain2000" title="Code">💻</a></td>
203-
<td align="center"><a href="https://github.com/kitloong"><img src="https://avatars2.githubusercontent.com/u/7660346?v=4" width="100px;" alt=""/><br /><sub><b>Kit Loong</b></sub></a><br /><a href="https://github.com/kevincobain2000/laravel-alert-notifications/pulls?q=is%3Apr+reviewed-by%3Akitloong" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/kevincobain2000/laravel-alert-notifications/commits?author=kitloong" title="Tests">⚠️</a> <a href="https://github.com/kevincobain2000/laravel-alert-notifications/commits?author=kitloong" title="Code">💻</a></td>
204-
<td align="center"><a href="https://github.com/truongns"><img src="https://avatars2.githubusercontent.com/u/11814875?v=4" width="100px;" alt=""/><br /><sub><b>Truong Nguyen</b></sub></a><br /><a href="https://github.com/kevincobain2000/laravel-alert-notifications/pulls?q=is%3Apr+reviewed-by%3Atruongns" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/kevincobain2000/laravel-alert-notifications/commits?author=truongns" title="Tests">⚠️</a> <a href="https://github.com/kevincobain2000/laravel-alert-notifications/commits?author=truongns" title="Code">💻</a></td>
205-
</tr>
206-
</table>
207200

201+
<a href="https://github.com/rakutentech/laravel-request-docs/graphs/contributors">
202+
<img src="https://contrib.rocks/image?repo=rakutentech/laravel-request-docs" />
203+
</a>

ui/src/components/ApiAction.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,15 @@ export default function ApiAction(props: Props) {
129129
setResponseStatus(response.status)
130130
setResponseHeaders(JSON.stringify(Object.fromEntries(response.headers), null, 2))
131131
setSendingRequest(false)
132-
return response.json();
132+
return response.text()
133133
}).then((data) => {
134+
let isJson = true
135+
try {
136+
data = JSON.parse(data)
137+
} catch (error: any) {
138+
isJson = false
139+
// do nothing
140+
}
134141

135142
if (data && data._lrd && data._lrd.queries) {
136143
const sqlQueries = data._lrd.queries.map((query: any) => {
@@ -164,7 +171,12 @@ export default function ApiAction(props: Props) {
164171
if (data && data._lrd) {
165172
delete data._lrd
166173
}
167-
setResponseData(JSON.stringify(data, null, 2))
174+
if (isJson) {
175+
setResponseData(JSON.stringify(data, null, 2))
176+
} else {
177+
setResponseData(data)
178+
}
179+
168180
setActiveTab('response')
169181
}).catch((error) => {
170182
setError("Response error: " + error)

ui/src/components/elements/ApiActionTabs.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export default function ApiActionTabs(props: Props) {
6161
<TableCellsIcon className='inline-block w-5 h-5 mr-1' /> Events
6262
{responseStatus != 0 && (
6363
<div className="ml-1 badge badge-xs badge-warning">
64-
{Object.keys(modelsData).length}
64+
{(modelsData && modelsData.modelsSummary) ? Object.keys(modelsData.modelsSummary).length : 0}
6565
</div>
6666
)}
6767
</a>

ui/src/global.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ td {
102102
@apply badge-ghost;
103103
}
104104

105-
.badge-200,.badge-201,.badge-202,.response-204, {
105+
.badge-200,.badge-201,.badge-202,.response-204 {
106106
@apply bg-success;
107107
}
108108

0 commit comments

Comments
 (0)