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

Add support for PATCH request to ResourceTestRule client when using Grizzly #2410

Merged
merged 1 commit into from
Jun 26, 2018

Conversation

danpeter
Copy link
Contributor

@danpeter danpeter commented Jun 25, 2018

Problem:

When using the client from ResourceTestRule with the Grizzly container it is not possible to use PATCH via the custom annotation io.dropwizard.jersey.PATCH. (It seems to work with the in-memory container)
Similar to: #2287

Solution:

Since the builder takes a Consumer<ClientConfig> instead of a property, like in #2287 I choose to set it in the Resource instead of manipulating the builder. This solution is up for discussion.

   protected Resource buildResource() {
   ...
   Consumer<ClientConfig> extendedConfigurator = config -> {
                clientConfigurator.accept(config);
                config.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true);
            };
Result:

Now possible to use the client and make a PATCH reuqest
client.target(...).request(...).method("PATCH", Entity.text("Patch is working"), String.class)

@nickbabcock
Copy link
Contributor

Looks our CI failed due to an unrelated test. Should be fixed with a commit I just pushed: ff69c2d. Can you rebase off master? 😄

@danpeter
Copy link
Contributor Author

@nickbabcock I rebased but it is still failing

Copy link
Member

@joschi joschi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danpeter It's still an unrelated flakey test. ☹️

I'll approve and merge this PR.

@joschi joschi merged commit 3b14a58 into dropwizard:master Jun 26, 2018
@danpeter danpeter deleted the resource-test-rule-patch branch June 26, 2018 11:14
@jplock jplock added this to the 2.0.0 milestone Jun 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants