Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No support for reqex on whole server's response body #199

Closed
mchmielarz opened this issue Feb 24, 2016 · 3 comments
Closed

No support for reqex on whole server's response body #199

mchmielarz opened this issue Feb 24, 2016 · 3 comments

Comments

@mchmielarz
Copy link

It would be quite useful to have possibility to do regular expression on whole response body returning for server side. Here is my case:

io.codearte.accurest.dsl.GroovyDsl.make {
    request {
        method('POST')
        url(PATH)
        headers {
            header("Content-Type": FORM_CONTENT_TYPE)
        }
        body(
                """field=${value(client("something"), server("else"))}"""
        )
    }
    response {
        status 400
        body (value(client("Processing failed with 400 status."), server(regex(".*400.*"))))
    }
}

I want to return 400 in a body of the client stub. And that's ok actually. On the other hand for server tests I'm able to generate such status by sending malformed request. In this case body will contain some standard HTML with 400 added somewhere in between. Regex in such case will free me from pasting whole HTML in stub definition.

@mchmielarz mchmielarz changed the title No support for reqexp on whole response body No support for reqex on whole response body Feb 24, 2016
@mchmielarz mchmielarz changed the title No support for reqex on whole response body No support for reqex on whole server's response body Feb 24, 2016
@marcingrzejszczak
Copy link
Contributor

As a workaround you can write that piece of functionality in the code and use this https://github.com/Codearte/accurest/wiki/3.-Contract-DSL#executing-custom-methods-on-server-side

@mchmielarz
Copy link
Author

The workaround didn't worked.

@marcingrzejszczak
Copy link
Contributor

This issue was moved to spring-cloud/spring-cloud-contract#17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants