File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ func validateReply(reply *Reply) error {
9595 if reply .Meta == nil {
9696 return fmt .Errorf ("response is missing metadata" )
9797 }
98- if reply .Meta .Status != 0 && (reply .Meta .Status < 100 || reply .Meta .Status > 599 ) {
98+ if reply .Meta .Status != 0 && (reply .Meta .Status < 200 || reply .Meta .Status > 599 ) {
9999 return fmt .Errorf ("response has invalid status %d" , reply .Meta .Status )
100100 }
101101 if reply .BodyEncoding != "" && reply .BodyEncoding != "base64" {
Original file line number Diff line number Diff line change 44 "context"
55 "encoding/base64"
66 "encoding/json"
7+ "fmt"
78 "io"
89 "net"
910 "net/http"
@@ -290,6 +291,15 @@ func TestValidateReplyRejectsInvalidHTTPJSONResponse(t *testing.T) {
290291 }
291292}
292293
294+ func TestValidateReplyRejectsInformationalStatus (t * testing.T ) {
295+ for _ , status := range []int {100 , 103 , 199 } {
296+ reply := & Reply {Type : "HTTPJSON-REP" , Meta : & ReplyMeta {Status : status }}
297+ if err := validateReply (reply ); err == nil || ! strings .Contains (err .Error (), fmt .Sprintf ("invalid status %d" , status )) {
298+ t .Fatalf ("validateReply() error = %v, want invalid status error" , err )
299+ }
300+ }
301+ }
302+
293303func TestValidateReplyRejectsUnknownBodyEncoding (t * testing.T ) {
294304 reply := & Reply {Meta : & ReplyMeta {}, BodyEncoding : "base64url" }
295305 if err := validateReply (reply ); err == nil || ! strings .Contains (err .Error (), "unsupported body encoding" ) {
You can’t perform that action at this time.
0 commit comments