good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
J
jrpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
open
jrpc
Commits
f10bbf40
Verified
Commit
f10bbf40
authored
1 year ago
by
a
Browse files
Options
Downloads
Patches
Plain Diff
a
parent
9dfe16e1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#60434
passed
1 year ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
contrib/codecs/http/codecs.go
+0
-43
0 additions, 43 deletions
contrib/codecs/http/codecs.go
with
0 additions
and
43 deletions
contrib/codecs/http/codecs.go
+
0
−
43
View file @
f10bbf40
...
...
@@ -37,11 +37,6 @@ func NewCodec(w http.ResponseWriter, r *http.Request) (jsonrpc.ReaderWriter, err
return
NewGetCodec
(
w
,
r
),
nil
case
http
.
MethodPost
:
return
NewPostCodec
(
w
,
r
)
case
"JRPC"
:
if
r
.
Header
.
Get
(
"Accept"
)
==
"text/event-stream"
||
r
.
URL
.
Query
()
.
Has
(
"sse"
)
{
return
NewSseCodec
(
w
,
r
)
}
return
NewJrpcCodec
(
w
,
r
)
default
:
http
.
Error
(
w
,
"method not supported"
,
http
.
StatusMethodNotAllowed
)
return
nil
,
errors
.
New
(
"method not allowed"
)
...
...
@@ -128,44 +123,6 @@ func NewPostCodec(w http.ResponseWriter, r *http.Request) (*HttpCodec, error) {
return
c
,
nil
}
func
NewJrpcCodec
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
(
*
HttpCodec
,
error
)
{
c
:=
&
HttpCodec
{
r
:
r
,
w
:
w
,
i
:
jsonrpc
.
PeerInfo
{
Transport
:
"http"
,
RemoteAddr
:
r
.
RemoteAddr
,
HTTP
:
r
.
Clone
(
r
.
Context
()),
},
}
c
.
ctx
,
c
.
cn
=
context
.
WithCancel
(
r
.
Context
())
flusher
,
ok
:=
w
.
(
http
.
Flusher
)
if
ok
{
c
.
f
=
flusher
}
data
,
err
:=
io
.
ReadAll
(
r
.
Body
)
if
err
!=
nil
{
return
nil
,
err
}
method
:=
strings
.
TrimPrefix
(
r
.
URL
.
Path
,
"/"
)
id
:=
r
.
Header
.
Get
(
"Jrpc-Request-Id"
)
if
id
==
""
{
id
=
"none"
}
c
.
msgs
=
&
serverutil
.
Bundle
{
Messages
:
[]
*
jsonrpc
.
Message
{{
ID
:
jsonrpc
.
NewId
(
id
),
Method
:
method
,
Params
:
data
,
}},
Batch
:
false
,
}
return
c
,
nil
}
// gets the peer info
func
(
c
*
HttpCodec
)
PeerInfo
()
jsonrpc
.
PeerInfo
{
return
c
.
i
...
...
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