Beispiel #1
0
func (p *RestResponse) writeField2(oprot thrift.TProtocol) (err error) {
	if p.IsSetHeaders() {
		if err := oprot.WriteFieldBegin("headers", thrift.MAP, 2); err != nil {
			return fmt.Errorf("%T write field begin error 2:headers: %s", p, err)
		}
		if err := oprot.WriteMapBegin(thrift.STRING, thrift.STRING, len(p.Headers)); err != nil {
			return fmt.Errorf("error writing map begin: %s", err)
		}
		for k, v := range p.Headers {
			if err := oprot.WriteString(string(k)); err != nil {
				return fmt.Errorf("%T. (0) field write error: %s", p, err)
			}
			if err := oprot.WriteString(string(v)); err != nil {
				return fmt.Errorf("%T. (0) field write error: %s", p, err)
			}
		}
		if err := oprot.WriteMapEnd(); err != nil {
			return fmt.Errorf("error writing map end: %s", err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return fmt.Errorf("%T write field end error 2:headers: %s", p, err)
		}
	}
	return err
}