diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2021-01-11 20:38:34 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-11 20:38:34 +0900 |
| commit | 6c975275f82c79eed2c7757d55283c95d23ca5b8 (patch) | |
| tree | 2871e4c3a1a67295ea5c3e19b9136ae79a17088c /src/server/api/api-handler.ts | |
| parent | fix context menu (diff) | |
| download | sharkey-6c975275f82c79eed2c7757d55283c95d23ca5b8.tar.gz sharkey-6c975275f82c79eed2c7757d55283c95d23ca5b8.tar.bz2 sharkey-6c975275f82c79eed2c7757d55283c95d23ca5b8.zip | |
Registry (#7073)
* wip
* wip
* wip
* wip
* wip
* Update registry.value.vue
* wip
* wip
* wip
* wip
* typo
Diffstat (limited to 'src/server/api/api-handler.ts')
| -rw-r--r-- | src/server/api/api-handler.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/server/api/api-handler.ts b/src/server/api/api-handler.ts index 7fbc200fc0..80a4fd97c8 100644 --- a/src/server/api/api-handler.ts +++ b/src/server/api/api-handler.ts @@ -11,7 +11,7 @@ export default (endpoint: IEndpoint, ctx: Koa.Context) => new Promise((res) => { const reply = (x?: any, y?: ApiError) => { if (x == null) { ctx.status = 204; - } else if (typeof x === 'number') { + } else if (typeof x === 'number' && y) { ctx.status = x; ctx.body = { error: { @@ -23,7 +23,8 @@ export default (endpoint: IEndpoint, ctx: Koa.Context) => new Promise((res) => { } }; } else { - ctx.body = x; + // 文字列を返す場合は、JSON.stringify通さないとJSONと認識されない + ctx.body = typeof x === 'string' ? JSON.stringify(x) : x; } res(); }; |