mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-09 22:47:24 +00:00
rpc: fix content-type header
This commit is contained in:
committed by
GitHub
parent
e0cf94f5b0
commit
53463b3fef
23
CHANGELOG.md
23
CHANGELOG.md
@@ -1,5 +1,28 @@
|
||||
# Changelog
|
||||
|
||||
## v0.34.0-rc6
|
||||
|
||||
*November 5, 2020*
|
||||
|
||||
Friendly reminder, we have a [bug bounty program](https://hackerone.com/tendermint).
|
||||
|
||||
### IMPROVEMENTS
|
||||
|
||||
- [statesync] \#5516 Check that all heights necessary to rebuild state for a snapshot exist before adding the snapshot to the pool. (@erikgrinaker)
|
||||
|
||||
### BUG FIXES
|
||||
|
||||
- [blockchain/v2] \#5499 Fix "duplicate block enqueued by processor" panic (@melekes)
|
||||
- [abci/grpc] \#5520 Return async responses in order, to avoid mempool panics. (@erikgrinaker)
|
||||
- [blockchain/v2] \#5530 Fix "processed height 4541 but expected height 4540" panic (@melekes)
|
||||
- [consensus/wal] Fix WAL autorepair by opening target WAL in read/write mode (@erikgrinaker)
|
||||
- [block] \#5567 Fix MaxCommitSigBytes (@cmwaters)
|
||||
- [blockchain/v2] \#5553 Make the removal of an already removed peer a noop (@melekes)
|
||||
- [evidence] \#5574 Fix bug where node sends committed evidence to peer (@cmwaters)
|
||||
- [privval] \#5583 Make `Vote`, `Proposal` & `PubKey` non-nullable in Responses (@marbar3778)
|
||||
- [evidence] \#5610 Make it possible for abci evidence to be formed from tm evidence (@cmwaters)
|
||||
- [privval] \#5638 Increase read/write timeout to 5s and calculate ping interval based on it (@JoeKash)
|
||||
|
||||
## v0.34.0-rc5
|
||||
|
||||
*October 13, 2020*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Unreleased Changes
|
||||
|
||||
## v0.34.0-rc6
|
||||
## v0.34.0-rc7
|
||||
|
||||
Special thanks to external contributors on this release:
|
||||
|
||||
@@ -22,17 +22,6 @@ Friendly reminder, we have a [bug bounty program](https://hackerone.com/tendermi
|
||||
|
||||
### IMPROVEMENTS
|
||||
|
||||
- [statesync] \#5516 Check that all heights necessary to rebuild state for a snapshot exist before adding the snapshot to the pool. (@erikgrinaker)
|
||||
|
||||
### BUG FIXES
|
||||
|
||||
- [blockchain/v2] \#5499 Fix "duplicate block enqueued by processor" panic (@melekes)
|
||||
- [abci/grpc] \#5520 Return async responses in order, to avoid mempool panics. (@erikgrinaker)
|
||||
- [blockchain/v2] \#5530 Fix "processed height 4541 but expected height 4540" panic (@melekes)
|
||||
- [consensus/wal] Fix WAL autorepair by opening target WAL in read/write mode (@erikgrinaker)
|
||||
- [block] \#5567 Fix MaxCommitSigBytes (@cmwaters)
|
||||
- [blockchain/v2] \#5553 Make the removal of an already removed peer a noop (@melekes)
|
||||
- [evidence] \#5574 Fix bug where node sends committed evidence to peer (@cmwaters)
|
||||
- [privval] \#5583 Make `Vote`, `Proposal` & `PubKey` non-nullable in Responses (@marbar3778)
|
||||
- [evidence] \#5610 Make it possible for abci evidence to be formed from tm evidence (@cmwaters)
|
||||
- [privval] \#5638 Increase read/write timeout to 5s and calculate ping interval based on it (@JoeKash)
|
||||
- [rpc] \#5660 Set `application/json` as the `Content-Type` header in RPC responses.
|
||||
|
||||
@@ -151,10 +151,13 @@ func NewWithHTTPClient(remote string, client *http.Client) (*Client, error) {
|
||||
}
|
||||
|
||||
// Call issues a POST HTTP request. Requests are JSON encoded. Content-Type:
|
||||
// text/json.
|
||||
func (c *Client) Call(ctx context.Context, method string,
|
||||
params map[string]interface{}, result interface{}) (interface{}, error) {
|
||||
|
||||
// application/json.
|
||||
func (c *Client) Call(
|
||||
ctx context.Context,
|
||||
method string,
|
||||
params map[string]interface{},
|
||||
result interface{},
|
||||
) (interface{}, error) {
|
||||
id := c.nextRequestID()
|
||||
|
||||
request, err := types.MapToRequest(id, method, params)
|
||||
@@ -172,14 +175,18 @@ func (c *Client) Call(ctx context.Context, method string,
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("request failed: %w", err)
|
||||
}
|
||||
httpRequest.Header.Set("Content-Type", "text/json")
|
||||
|
||||
httpRequest.Header.Set("Content-Type", "application/json")
|
||||
|
||||
if c.username != "" || c.password != "" {
|
||||
httpRequest.SetBasicAuth(c.username, c.password)
|
||||
}
|
||||
|
||||
httpResponse, err := c.client.Do(httpRequest)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("post failed: %w", err)
|
||||
}
|
||||
|
||||
defer httpResponse.Body.Close()
|
||||
|
||||
responseBytes, err := ioutil.ReadAll(httpResponse.Body)
|
||||
@@ -216,14 +223,18 @@ func (c *Client) sendBatch(ctx context.Context, requests []*jsonRPCBufferedReque
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("new request: %w", err)
|
||||
}
|
||||
httpRequest.Header.Set("Content-Type", "text/json")
|
||||
|
||||
httpRequest.Header.Set("Content-Type", "application/json")
|
||||
|
||||
if c.username != "" || c.password != "" {
|
||||
httpRequest.SetBasicAuth(c.username, c.password)
|
||||
}
|
||||
|
||||
httpResponse, err := c.client.Do(httpRequest)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("post: %w", err)
|
||||
}
|
||||
|
||||
defer httpResponse.Body.Close()
|
||||
|
||||
responseBytes, err := ioutil.ReadAll(httpResponse.Body)
|
||||
|
||||
Reference in New Issue
Block a user