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

StubsResponseHandlingStrategyFactory doesn't honor 404 responses #92

Closed
MannanM opened this issue Mar 15, 2018 · 2 comments
Closed

StubsResponseHandlingStrategyFactory doesn't honor 404 responses #92

MannanM opened this issue Mar 15, 2018 · 2 comments

Comments

@MannanM
Copy link

MannanM commented Mar 15, 2018

If you set a custom stub to return a 404 response with payload,

   response:
      status: 404
      body: { "foo": "bar" }

Stubby4J doesn't honor it and instead uses the NotFoundResponseHandlingStrategy.

    public static StubResponseHandlingStrategy getStrategy(final StubResponse foundStubResponse) {
        final HttpStatus.Code httpStatusCode = foundStubResponse.getHttpStatusCode();
        switch (httpStatusCode) {
            case NOT_FOUND:
                return new NotFoundResponseHandlingStrategy();

I think it should at least check if the StubResponse has a body, and if so use the DefaultResponseHandlingStrategy instead.

@azagniotov
Copy link
Owner

Thank you. I will try to address it soon

@azagniotov
Copy link
Owner

This functionality will be available in the next release tomorrow

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

No branches or pull requests

2 participants