Allow for republish to be headers only

Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
Derek Collison
2022-05-30 11:21:51 -07:00
parent 1aa8cc716e
commit e08f6d863d
4 changed files with 108 additions and 29 deletions

View File

@@ -17,6 +17,7 @@
package server
import (
"encoding/json"
"fmt"
"io/ioutil"
"math/rand"
@@ -1326,3 +1327,21 @@ func (c *cluster) stableTotalSubs() (total int) {
return nsubs
}
func addStream(t *testing.T, nc *nats.Conn, cfg *StreamConfig) *StreamInfo {
t.Helper()
req, err := json.Marshal(cfg)
require_NoError(t, err)
rmsg, err := nc.Request(fmt.Sprintf(JSApiStreamCreateT, cfg.Name), req, time.Second)
require_NoError(t, err)
var resp JSApiStreamCreateResponse
err = json.Unmarshal(rmsg.Data, &resp)
require_NoError(t, err)
if resp.Type != JSApiStreamCreateResponseType {
t.Fatalf("Invalid response type %s expected %s", resp.Type, JSApiStreamCreateResponseType)
}
if resp.Error != nil {
t.Fatalf("Unexpected error: %+v", resp.Error)
}
return resp.StreamInfo
}