func (p *PactClient) ReifyMessage(request *types.PactReificationRequest) (res *types.ReificationResponse, err error) {
	log.Println("[DEBUG] client: adding pact message...")

	var responseObject interface{}
	res = &types.ReificationResponse{
		Response: responseObject,
	}

	// Convert request into flags, and validate request
	err = request.Validate()
	if err != nil {
		return
	}

	svc := p.messageSvcManager.NewService(request.Args)
	cmd := svc.Command()

	stdOutPipe, err := cmd.StdoutPipe()
	if err != nil {
		return
	}
	stdErrPipe, err := cmd.StderrPipe()
	if err != nil {
		return
	}
	err = cmd.Start()
	if err != nil {
		return
	}
	stdOut, err := ioutil.ReadAll(stdOutPipe)
	if err != nil {
		return
	}
	stdErr, err := ioutil.ReadAll(stdErrPipe)
	if err != nil {
		return
	}

	err = cmd.Wait()

	res.ResponseRaw = stdOut
	decoder := json.NewDecoder(bytes.NewReader(stdOut))

	dErr := decoder.Decode(&res.Response)
	if dErr == nil {
		return
	}

	if err == nil {
		err = dErr
	}

	if err == nil {
		return
	}

	err = fmt.Errorf("error creating message: %s\n\nSTDERR:\n%s\n\nSTDOUT:\n%s", err, stdErr, stdOut)

	return
}
func (p *PactClient) ReifyMessage(request *types.PactReificationRequest) (res *types.ReificationResponse, err error) {
	log.Println("[DEBUG] client: adding pact message...")

	var responseObject interface{}
	res = &types.ReificationResponse{
		Response: responseObject,
	}

	
	err = request.Validate()
	if err != nil {
		return
	}

	svc := p.messageSvcManager.NewService(request.Args)
	cmd := svc.Command()

	stdOutPipe, err := cmd.StdoutPipe()
	if err != nil {
		return
	}
	stdErrPipe, err := cmd.StderrPipe()
	if err != nil {
		return
	}
	err = cmd.Start()
	if err != nil {
		return
	}
	stdOut, err := ioutil.ReadAll(stdOutPipe)
	if err != nil {
		return
	}
	stdErr, err := ioutil.ReadAll(stdErrPipe)
	if err != nil {
		return
	}

	err = cmd.Wait()

	res.ResponseRaw = stdOut
	decoder := json.NewDecoder(bytes.NewReader(stdOut))

	dErr := decoder.Decode(&res.Response)
	if dErr == nil {
		return
	}

	if err == nil {
		err = dErr
	}

	if err == nil {
		return
	}

	err = fmt.Errorf("error creating message: %s\n\nSTDERR:\n%s\n\nSTDOUT:\n%s", err, stdErr, stdOut)

	return
}
func ( p * PactClient ) ReifyMessage ( request * types . PactReificationRequest ) ( res * types . ReificationResponse , err error ) { log . Println ( " " ) var responseObject interface { } res = & types . ReificationResponse { Response : responseObject , } // Convert request into flags, and validate request err = request . Validate ( ) if err != nil { return } svc := p . messageSvcManager . NewService ( request . Args ) cmd := svc . Command ( ) stdOutPipe , err := cmd . StdoutPipe ( ) if err != nil { return } stdErrPipe , err := cmd . StderrPipe ( ) if err != nil { return } err = cmd . Start ( ) if err != nil { return } stdOut , err := ioutil . ReadAll ( stdOutPipe ) if err != nil { return } stdErr , err := ioutil . ReadAll ( stdErrPipe ) if err != nil { return } err = cmd . Wait ( ) res . ResponseRaw = stdOut decoder := json . NewDecoder ( bytes . NewReader ( stdOut ) ) dErr := decoder . Decode ( & res . Response ) if dErr == nil { return } if err == nil { err = dErr } if err == nil { return } err = fmt . Errorf ( " \n \n \n \n \n \n " , err , stdErr , stdOut ) return }
// ReifyMessage takes a structured object, potentially containing nested Matchers
// and returns an object with just the example (generated) content
// The object may be a simple JSON primitive e.g. string or number or a complex object
ReifyMessage takes a structured object potentially containing nested Matchers and returns an object with just the example ( generated ) content The object may be a simple JSON primitive e . g . string or number or a complex object