Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
HAfAH
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
HAfAH
Commits
2855e353
Commit
2855e353
authored
6 months ago
by
Michal Zander
Committed by
Bartek Wrona
4 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Catch null results in json-rpc apis
parent
8442a808
No related branches found
No related tags found
1 merge request
!148
Catch null results in json-rpc apis
Pipeline
#107663
passed
4 months ago
Stage: build
Stage: test
Stage: publish
Stage: cleanup
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
postgrest/hafah_endpoints.sql
+7
-2
7 additions, 2 deletions
postgrest/hafah_endpoints.sql
with
7 additions
and
2 deletions
postgrest/hafah_endpoints.sql
+
7
−
2
View file @
2855e353
...
...
@@ -42,7 +42,7 @@ DECLARE
__params
JSON
;
__id
JSON
;
__result
JSON
;
__result
JSON
B
;
__api_type
TEXT
;
__method_type
TEXT
;
__is_legacy_style
BOOLEAN
;
...
...
@@ -53,7 +53,7 @@ BEGIN
__params
=
(
__request_data
->
'params'
);
__id
=
(
__request_data
->
'id'
);
SELECT
NULL
::
JSON
INTO
__result
;
SELECT
NULL
::
JSON
B
INTO
__result
;
IF
__jsonrpc
!=
'2.0'
OR
__jsonrpc
IS
NULL
OR
__params
IS
NULL
OR
__id
IS
NULL
THEN
RETURN
hafah_backend
.
raise_exception
(
-
32600
,
'Invalid JSON-RPC'
);
...
...
@@ -90,6 +90,11 @@ BEGIN
END
IF
;
END
IF
;
IF
__result
=
'null'
THEN
RAISE
NOTICE
'null in % api'
,
__method
;
__result
:
=
'[]'
::
JSONB
;
END
IF
;
IF
__result
IS
NULL
THEN
RETURN
hafah_backend
.
raise_exception
(
-
32601
,
'Method not found'
,
__method
,
__id
);
ELSEIF
__result
->
'error'
IS
NULL
THEN
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment