File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -532,7 +532,9 @@ paths:
532532 response := & http.Response {
533533 Header : http.Header {},
534534 StatusCode : http .StatusOK ,
535- Body : nil , // invalid response body
535+ // The http Client and Transport guarantee that Body is always non-nil
536+ // and will be set to [http.NoBody] if no body is present.
537+ Body : http .NoBody ,
536538 }
537539 response .Header .Set (helpers .ContentTypeHeader , helpers .JSONContentType )
538540
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ func ValidateResponseSchema(
4545
4646 var validationErrors []* errors.ValidationError
4747
48- if response == nil || response .Body == nil {
48+ if response == nil || response .Body == http . NoBody {
4949 // cannot decode the response body, so it's not valid
5050 violation := & errors.SchemaValidationFailure {
5151 Reason : "response is empty" ,
You can’t perform that action at this time.
0 commit comments