forked from loafle/openapi-generator-original
[Java][Client] Add PATCH method support for jersey2 (#6197)
This commit is contained in:
committed by
wing328
parent
443b0f142b
commit
a6f981350e
@@ -13,6 +13,7 @@ import javax.ws.rs.core.Response.Status;
|
||||
|
||||
import org.glassfish.jersey.client.ClientConfig;
|
||||
import org.glassfish.jersey.client.ClientProperties;
|
||||
import org.glassfish.jersey.client.HttpUrlConnectorProvider;
|
||||
import org.glassfish.jersey.jackson.JacksonFeature;
|
||||
import org.glassfish.jersey.logging.LoggingFeature;
|
||||
import org.glassfish.jersey.media.multipart.FormDataBodyPart;
|
||||
@@ -695,7 +696,7 @@ public class ApiClient {
|
||||
} else if ("DELETE".equals(method)) {
|
||||
response = invocationBuilder.delete();
|
||||
} else if ("PATCH".equals(method)) {
|
||||
response = invocationBuilder.header("X-HTTP-Method-Override", "PATCH").post(entity);
|
||||
response = invocationBuilder.method("PATCH", entity);
|
||||
} else {
|
||||
throw new ApiException(500, "unknown method type " + method);
|
||||
}
|
||||
@@ -746,6 +747,7 @@ public class ApiClient {
|
||||
clientConfig.register(MultiPartFeature.class);
|
||||
clientConfig.register(json);
|
||||
clientConfig.register(JacksonFeature.class);
|
||||
clientConfig.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true);
|
||||
if (debugging) {
|
||||
clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */));
|
||||
clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY);
|
||||
|
||||
Reference in New Issue
Block a user