URL based matching
guyisra opened this issue · 9 comments
I am using PACT to mock a service which uses a REST based urls
resource/resource_id/system/system_id
Is there a way to avoid have a predefined resource_id/system_id which must be used by the consumer and provider? I.e. resource_id should look like a UUID, but it really doesn't matter, as long as its consitent throughout the mocking - if I request resource/resource_id, resource_id
should use whatever has been sent, as long as it matching that I specificied
I understand there is support for query parameters, is there a way to do this for REST-like url params?
I'm not sure if regex expression work with paths. I'll need to confirm.
It does in the consumer side, but you need to provide a concrete example
for replay on the provider.
On Saturday, May 28, 2016, Ronald Holshausen notifications@github.com
wrote:
I'm not sure if regex expression work with paths. I'll need to confirm.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/realestate-com-au/pact/issues/107#issuecomment-222281025,
or mute the thread
https://github.com/notifications/unsubscribe/AAbPFAfebO_aLlBkkd0PeZG4CPjiruIHks5qF5GvgaJpZM4IoeEN
.
how does it work with regex?
@bethesque Can you give an example of how this can be done?
It would be nice if there were a way to not have to specify a value for the provider.
I'm wondering if there can be a generator in the :path, something along the lines of path: '/some_path/{some_generator.generate}' . For example we use lots of uuids and it would be handy to randomly generate the uuid and be able to use retrieve the value for use in the provider state to make the service call. Otherwise, we have to map uuids across projects to provider states. That seems like it could get out of hand. But maybe I'm missing something?
Generators are defined as part of the V3 specification, which is not implemented for Ruby as yet: https://github.com/pact-foundation/pact-specification/tree/version-3#introduce-example-generators
Thanks for the quick response :)