func (p *Pact) VerifyMessageConsumerRaw(message *Message, handler MessageConsumer) error {
	log.Printf("[DEBUG] verify message")
	p.Setup(false)

	// Reify the message back to its "example/generated" form
	reified, err := p.pactClient.ReifyMessage(&types.PactReificationRequest{
		Message: message.Content,
	})

	if err != nil {
		return fmt.Errorf("unable to convert consumer test to a valid JSON representation: %v", err)
	}

	t := reflect.TypeOf(message.Type)
	if t != nil && t.Name() != "interface" {
		log.Println("[DEBUG] narrowing type to", t.Name())
		err = json.Unmarshal(reified.ResponseRaw, &message.Type)

		if err != nil {
			return fmt.Errorf("unable to narrow type to %v: %v", t.Name(), err)
		}
	}

	// Yield message, and send through handler function
	generatedMessage :=
		Message{
			Content:     message.Type,
			States:      message.States,
			Description: message.Description,
			Metadata:    message.Metadata,
		}

	err = handler(generatedMessage)
	if err != nil {
		return err
	}

	// If no errors, update Message Pact
	return p.pactClient.UpdateMessagePact(types.PactMessageRequest{
		Message:  message,
		Consumer: p.Consumer,
		Provider: p.Provider,
		PactDir:  p.PactDir,
	})
}
func (p *Pact) VerifyMessageConsumerRaw(message *Message, handler MessageConsumer) error {
	log.Printf("[DEBUG] verify message")
	p.Setup(false)

	
	reified, err := p.pactClient.ReifyMessage(&types.PactReificationRequest{
		Message: message.Content,
	})

	if err != nil {
		return fmt.Errorf("unable to convert consumer test to a valid JSON representation: %v", err)
	}

	t := reflect.TypeOf(message.Type)
	if t != nil && t.Name() != "interface" {
		log.Println("[DEBUG] narrowing type to", t.Name())
		err = json.Unmarshal(reified.ResponseRaw, &message.Type)

		if err != nil {
			return fmt.Errorf("unable to narrow type to %v: %v", t.Name(), err)
		}
	}

	
	generatedMessage :=
		Message{
			Content:     message.Type,
			States:      message.States,
			Description: message.Description,
			Metadata:    message.Metadata,
		}

	err = handler(generatedMessage)
	if err != nil {
		return err
	}

	
	return p.pactClient.UpdateMessagePact(types.PactMessageRequest{
		Message:  message,
		Consumer: p.Consumer,
		Provider: p.Provider,
		PactDir:  p.PactDir,
	})
}
func ( p * Pact ) VerifyMessageConsumerRaw ( message * Message , handler MessageConsumer ) error { log . Printf ( " " ) p . Setup ( false ) // Reify the message back to its "example/generated" form reified , err := p . pactClient . ReifyMessage ( & types . PactReificationRequest { Message : message . Content , } ) if err != nil { return fmt . Errorf ( " " , err ) } t := reflect . TypeOf ( message . Type ) if t != nil && t . Name ( ) != " " { log . Println ( " " , t . Name ( ) ) err = json . Unmarshal ( reified . ResponseRaw , & message . Type ) if err != nil { return fmt . Errorf ( " " , t . Name ( ) , err ) } } // Yield message, and send through handler function generatedMessage := Message { Content : message . Type , States : message . States , Description : message . Description , Metadata : message . Metadata , } err = handler ( generatedMessage ) if err != nil { return err } // If no errors, update Message Pact return p . pactClient . UpdateMessagePact ( types . PactMessageRequest { Message : message , Consumer : p . Consumer , Provider : p . Provider , PactDir : p . PactDir , } ) }
// VerifyMessageConsumerRaw creates a new Pact _message_ interaction to build a testable
// interaction.
//
//
// A Message Consumer is analagous to a Provider in the HTTP Interaction model.
// It is the receiver of an interaction, and needs to be able to handle whatever
// request was provided.
VerifyMessageConsumerRaw creates a new Pact _message_ interaction to build a testable interaction . A Message Consumer is analagous to a Provider in the HTTP Interaction model . It is the receiver of an interaction and needs to be able to handle whatever request was provided .