Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hivemind
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository 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
hivemind
Commits
d8de5499
Commit
d8de5499
authored
4 years ago
by
Dariusz Kędzierski
Browse files
Options
Downloads
Plain Diff
Rebase to current develop
parents
95d682dc
6f1d9159
No related branches found
No related tags found
2 merge requests
!456
Release candidate v1 24
,
!211
Fix for issue #65
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hive/server/serve.py
+21
-2
21 additions, 2 deletions
hive/server/serve.py
with
21 additions
and
2 deletions
hive/server/serve.py
+
21
−
2
View file @
d8de5499
...
...
@@ -293,8 +293,27 @@ def run_server(conf):
"""
Handles all hive jsonrpc API requests.
"""
request
=
await
request
.
text
()
# debug=True refs https://github.com/bcb/jsonrpcserver/issues/71
response
=
await
dispatch
(
request
,
methods
=
methods
,
debug
=
True
,
context
=
app
,
serialize
=
decimal_serialize
,
deserialize
=
decimal_deserialize
)
if
response
.
wanted
:
response
=
None
try
:
response
=
await
dispatch
(
request
,
methods
=
methods
,
debug
=
True
,
context
=
app
,
serialize
=
decimal_serialize
,
deserialize
=
decimal_deserialize
)
except
simplejson
.
errors
.
JSONDecodeError
as
ex
:
# first log exception
# TODO: consider removing this log - potential log spam
log
.
exception
(
ex
)
# create and send error response
error_response
=
{
"
jsonrpc
"
:
"
2.0
"
,
"
error
"
:
{
"
code
"
:
-
32602
,
"
data
"
:
"
Invalid JSON in request:
"
+
str
(
ex
),
"
message
"
:
"
Invalid parameters
"
},
"
id
"
:
-
1
}
headers
=
{
'
Access-Control-Allow-Origin
'
:
'
*
'
}
return
web
.
json_response
(
error_response
,
status
=
200
,
headers
=
headers
,
dumps
=
decimal_serialize
)
if
response
is
not
None
and
response
.
wanted
:
headers
=
{
'
Access-Control-Allow-Origin
'
:
'
*
'
}
return
web
.
json_response
(
response
.
deserialized
(),
status
=
200
,
headers
=
headers
,
dumps
=
decimal_serialize
)
return
web
.
Response
()
...
...
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