Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
163e996d
Unverified
Commit
163e996d
authored
Jan 24, 2023
by
Shude Li
Committed by
GitHub
Jan 24, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
all: use http package to replace http method names (#26535)
parent
e4fa2cf5
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
12 additions
and
12 deletions
+12
-12
faucet.go
cmd/faucet/faucet.go
+2
-2
sealer.go
consensus/ethash/sealer.go
+1
-1
graphiql.go
graphql/graphiql.go
+1
-1
client.go
metrics/librato/client.go
+1
-1
rpcstack_test.go
node/rpcstack_test.go
+2
-2
http.go
p2p/simulations/http.go
+4
-4
http.go
rpc/http.go
+1
-1
No files found.
cmd/faucet/faucet.go
View file @
163e996d
...
@@ -747,7 +747,7 @@ func authTwitter(url string, tokenV1, tokenV2 string) (string, string, string, c
...
@@ -747,7 +747,7 @@ func authTwitter(url string, tokenV1, tokenV2 string) (string, string, string, c
func
authTwitterWithTokenV1
(
tweetID
string
,
token
string
)
(
string
,
string
,
string
,
common
.
Address
,
error
)
{
func
authTwitterWithTokenV1
(
tweetID
string
,
token
string
)
(
string
,
string
,
string
,
common
.
Address
,
error
)
{
// Query the tweet details from Twitter
// Query the tweet details from Twitter
url
:=
fmt
.
Sprintf
(
"https://api.twitter.com/1.1/statuses/show.json?id=%s"
,
tweetID
)
url
:=
fmt
.
Sprintf
(
"https://api.twitter.com/1.1/statuses/show.json?id=%s"
,
tweetID
)
req
,
err
:=
http
.
NewRequest
(
"GET"
,
url
,
nil
)
req
,
err
:=
http
.
NewRequest
(
http
.
MethodGet
,
url
,
nil
)
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
""
,
""
,
common
.
Address
{},
err
return
""
,
""
,
""
,
common
.
Address
{},
err
}
}
...
@@ -784,7 +784,7 @@ func authTwitterWithTokenV1(tweetID string, token string) (string, string, strin
...
@@ -784,7 +784,7 @@ func authTwitterWithTokenV1(tweetID string, token string) (string, string, strin
func
authTwitterWithTokenV2
(
tweetID
string
,
token
string
)
(
string
,
string
,
string
,
common
.
Address
,
error
)
{
func
authTwitterWithTokenV2
(
tweetID
string
,
token
string
)
(
string
,
string
,
string
,
common
.
Address
,
error
)
{
// Query the tweet details from Twitter
// Query the tweet details from Twitter
url
:=
fmt
.
Sprintf
(
"https://api.twitter.com/2/tweets/%s?expansions=author_id&user.fields=profile_image_url"
,
tweetID
)
url
:=
fmt
.
Sprintf
(
"https://api.twitter.com/2/tweets/%s?expansions=author_id&user.fields=profile_image_url"
,
tweetID
)
req
,
err
:=
http
.
NewRequest
(
"GET"
,
url
,
nil
)
req
,
err
:=
http
.
NewRequest
(
http
.
MethodGet
,
url
,
nil
)
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
""
,
""
,
common
.
Address
{},
err
return
""
,
""
,
""
,
common
.
Address
{},
err
}
}
...
...
consensus/ethash/sealer.go
View file @
163e996d
...
@@ -379,7 +379,7 @@ func (s *remoteSealer) notifyWork() {
...
@@ -379,7 +379,7 @@ func (s *remoteSealer) notifyWork() {
func
(
s
*
remoteSealer
)
sendNotification
(
ctx
context
.
Context
,
url
string
,
json
[]
byte
,
work
[
4
]
string
)
{
func
(
s
*
remoteSealer
)
sendNotification
(
ctx
context
.
Context
,
url
string
,
json
[]
byte
,
work
[
4
]
string
)
{
defer
s
.
reqWG
.
Done
()
defer
s
.
reqWG
.
Done
()
req
,
err
:=
http
.
NewRequest
(
"POST"
,
url
,
bytes
.
NewReader
(
json
))
req
,
err
:=
http
.
NewRequest
(
http
.
MethodPost
,
url
,
bytes
.
NewReader
(
json
))
if
err
!=
nil
{
if
err
!=
nil
{
s
.
ethash
.
config
.
Log
.
Warn
(
"Can't create remote miner notification"
,
"err"
,
err
)
s
.
ethash
.
config
.
Log
.
Warn
(
"Can't create remote miner notification"
,
"err"
,
err
)
return
return
...
...
graphql/graphiql.go
View file @
163e996d
...
@@ -48,7 +48,7 @@ func errorJSON(msg string) []byte {
...
@@ -48,7 +48,7 @@ func errorJSON(msg string) []byte {
}
}
func
(
h
GraphiQL
)
ServeHTTP
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
func
(
h
GraphiQL
)
ServeHTTP
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
if
r
.
Method
!=
"GET"
{
if
r
.
Method
!=
http
.
MethodGet
{
respond
(
w
,
errorJSON
(
"only GET requests are supported"
),
http
.
StatusMethodNotAllowed
)
respond
(
w
,
errorJSON
(
"only GET requests are supported"
),
http
.
StatusMethodNotAllowed
)
return
return
}
}
...
...
metrics/librato/client.go
View file @
163e996d
...
@@ -80,7 +80,7 @@ func (c *LibratoClient) PostMetrics(batch Batch) (err error) {
...
@@ -80,7 +80,7 @@ func (c *LibratoClient) PostMetrics(batch Batch) (err error) {
return
return
}
}
if
req
,
err
=
http
.
NewRequest
(
"POST"
,
MetricsPostUrl
,
bytes
.
NewBuffer
(
js
));
err
!=
nil
{
if
req
,
err
=
http
.
NewRequest
(
http
.
MethodPost
,
MetricsPostUrl
,
bytes
.
NewBuffer
(
js
));
err
!=
nil
{
return
return
}
}
...
...
node/rpcstack_test.go
View file @
163e996d
...
@@ -167,7 +167,7 @@ func TestWebsocketOrigins(t *testing.T) {
...
@@ -167,7 +167,7 @@ func TestWebsocketOrigins(t *testing.T) {
// TestIsWebsocket tests if an incoming websocket upgrade request is handled properly.
// TestIsWebsocket tests if an incoming websocket upgrade request is handled properly.
func
TestIsWebsocket
(
t
*
testing
.
T
)
{
func
TestIsWebsocket
(
t
*
testing
.
T
)
{
r
,
_
:=
http
.
NewRequest
(
"GET"
,
"/"
,
nil
)
r
,
_
:=
http
.
NewRequest
(
http
.
MethodGet
,
"/"
,
nil
)
assert
.
False
(
t
,
isWebsocket
(
r
))
assert
.
False
(
t
,
isWebsocket
(
r
))
r
.
Header
.
Set
(
"upgrade"
,
"websocket"
)
r
.
Header
.
Set
(
"upgrade"
,
"websocket"
)
...
@@ -294,7 +294,7 @@ func baseRpcRequest(t *testing.T, url, bodyStr string, extraHeaders ...string) *
...
@@ -294,7 +294,7 @@ func baseRpcRequest(t *testing.T, url, bodyStr string, extraHeaders ...string) *
// Create the request.
// Create the request.
body
:=
bytes
.
NewReader
([]
byte
(
bodyStr
))
body
:=
bytes
.
NewReader
([]
byte
(
bodyStr
))
req
,
err
:=
http
.
NewRequest
(
"POST"
,
url
,
body
)
req
,
err
:=
http
.
NewRequest
(
http
.
MethodPost
,
url
,
body
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
"could not create http request:"
,
err
)
t
.
Fatal
(
"could not create http request:"
,
err
)
}
}
...
...
p2p/simulations/http.go
View file @
163e996d
...
@@ -102,7 +102,7 @@ type SubscribeOpts struct {
...
@@ -102,7 +102,7 @@ type SubscribeOpts struct {
// nodes and connections and filtering message events
// nodes and connections and filtering message events
func
(
c
*
Client
)
SubscribeNetwork
(
events
chan
*
Event
,
opts
SubscribeOpts
)
(
event
.
Subscription
,
error
)
{
func
(
c
*
Client
)
SubscribeNetwork
(
events
chan
*
Event
,
opts
SubscribeOpts
)
(
event
.
Subscription
,
error
)
{
url
:=
fmt
.
Sprintf
(
"%s/events?current=%t&filter=%s"
,
c
.
URL
,
opts
.
Current
,
opts
.
Filter
)
url
:=
fmt
.
Sprintf
(
"%s/events?current=%t&filter=%s"
,
c
.
URL
,
opts
.
Current
,
opts
.
Filter
)
req
,
err
:=
http
.
NewRequest
(
"GET"
,
url
,
nil
)
req
,
err
:=
http
.
NewRequest
(
http
.
MethodGet
,
url
,
nil
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -215,18 +215,18 @@ func (c *Client) RPCClient(ctx context.Context, nodeID string) (*rpc.Client, err
...
@@ -215,18 +215,18 @@ func (c *Client) RPCClient(ctx context.Context, nodeID string) (*rpc.Client, err
// Get performs a HTTP GET request decoding the resulting JSON response
// Get performs a HTTP GET request decoding the resulting JSON response
// into "out"
// into "out"
func
(
c
*
Client
)
Get
(
path
string
,
out
interface
{})
error
{
func
(
c
*
Client
)
Get
(
path
string
,
out
interface
{})
error
{
return
c
.
Send
(
"GET"
,
path
,
nil
,
out
)
return
c
.
Send
(
http
.
MethodGet
,
path
,
nil
,
out
)
}
}
// Post performs a HTTP POST request sending "in" as the JSON body and
// Post performs a HTTP POST request sending "in" as the JSON body and
// decoding the resulting JSON response into "out"
// decoding the resulting JSON response into "out"
func
(
c
*
Client
)
Post
(
path
string
,
in
,
out
interface
{})
error
{
func
(
c
*
Client
)
Post
(
path
string
,
in
,
out
interface
{})
error
{
return
c
.
Send
(
"POST"
,
path
,
in
,
out
)
return
c
.
Send
(
http
.
MethodPost
,
path
,
in
,
out
)
}
}
// Delete performs a HTTP DELETE request
// Delete performs a HTTP DELETE request
func
(
c
*
Client
)
Delete
(
path
string
)
error
{
func
(
c
*
Client
)
Delete
(
path
string
)
error
{
return
c
.
Send
(
"DELETE"
,
path
,
nil
,
nil
)
return
c
.
Send
(
http
.
MethodDelete
,
path
,
nil
,
nil
)
}
}
// Send performs a HTTP request, sending "in" as the JSON request body and
// Send performs a HTTP request, sending "in" as the JSON request body and
...
...
rpc/http.go
View file @
163e996d
...
@@ -209,7 +209,7 @@ func (hc *httpConn) doRequest(ctx context.Context, msg interface{}) (io.ReadClos
...
@@ -209,7 +209,7 @@ func (hc *httpConn) doRequest(ctx context.Context, msg interface{}) (io.ReadClos
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
req
,
err
:=
http
.
NewRequestWithContext
(
ctx
,
"POST"
,
hc
.
url
,
io
.
NopCloser
(
bytes
.
NewReader
(
body
)))
req
,
err
:=
http
.
NewRequestWithContext
(
ctx
,
http
.
MethodPost
,
hc
.
url
,
io
.
NopCloser
(
bytes
.
NewReader
(
body
)))
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment