ITV / scala-pact

A Scala implementation of CDC using the Pact standard
Other
107 stars 54 forks source link

Upgrading 1.0.2 -> 2.1.0 no matching request #37

Closed BenParker22 closed 7 years ago

BenParker22 commented 7 years ago

I have a repository of pact tests that run and pass fine on 1.0.2

Upon updating to 2.1.0 I get some errors of the form: No matching request for: InteractionRequest(Some(POST),Some(/users/password/reset),Some(email=uon@exa),Some(Map(Connection -> keep-alive, Content-Length -> 0, Accept -> application/vnd.user.password.v1+json, Content-type -> application/x-www-form-urlencoded, Accept-Encoding -> gzip,deflate, User-Agent -> scalaj-http/1.0, Host -> localhost:51465)),None,None)

Changing order of test execution did not change what tests fail, the same tests fail every time.

Some Post and Put requests had htis error.

BenParker22 commented 7 years ago

Dave noticed that this issue is related to the difference between a request with an empty body and a response with no body. Change a function like: uponReceiving(PUT, request.endPoint, None, request.header, Option(request.body), None)

to

uponReceiving(PUT, request.endPoint, None, request.header, if(request.body.isEmpty) None else Option(request.body), None)

Works for now as None is the expected way of displaying an empty body, rather than Some("")

davesmith00000 commented 7 years ago

Thanks Ben. As we discussed, technically it is doing the right thing but I'm going to raise a new issue to do with improving the DSL/builder api to make it easier to use and harder to make mistakes with.