@@ -5,15 +5,6 @@ import (
55 "errors"
66)
77
8- var (
9- errValidationResId = errors .New ("openrtb response: missing ID" )
10- errValidationResSeatbid = errors .New ("openrtb response: missing seatbids" )
11- errValidationSeatbidBid = errors .New ("openrtb response: seatbid is missing bids" )
12- errValidationBidId = errors .New ("openrtb response: bid is missing ID" )
13- errValidationBidImpid = errors .New ("openrtb response: bid is missing impression ID" )
14- errValidationBidPrice = errors .New ("openrtb response: bid is missing price" )
15- )
16-
178// ID and at least one “seatbid” object is required, which contains a bid on at least one impression.
189// Other attributes are optional since an exchange may establish default values.
1910// No-Bids on all impressions should be indicated as a HTTP 204 response.
@@ -33,14 +24,20 @@ func (res *Response) JSON() ([]byte, error) {
3324 return json .Marshal (res )
3425}
3526
27+ // Validation errors
28+ var (
29+ invalidResId = errors .New ("openrtb response: missing ID" )
30+ invalidResSeatbid = errors .New ("openrtb response: missing seatbids" )
31+ )
32+
3633// Validate Response required attributes
3734// @return [Boolean,Error] true if response,seatbid,bid required attrs present
3835func (res * Response ) Valid () (bool , error ) {
3936
4037 if res .Id == nil {
41- return false , errValidationResId
38+ return false , invalidResId
4239 } else if res .Seatbid == nil || len (res .Seatbid ) < 1 {
43- return false , errValidationResSeatbid
40+ return false , invalidResSeatbid
4441 }
4542
4643 for _ , sb := range res .Seatbid {
0 commit comments