0

I am using spring boot 1.5, Swagger client api(not rest template) for making calls to source.

I am using the PATCH approach for partial updates, and had no problem creating a server side annotation and implementation for this.

However, when I try to write client code for testing, it fails.

Invalid HTTP method: PATCH; nested exception is java.net.ProtocolException: Invalid HTTP method: PATCH

Interestingly, when our applications are deployed in docker, It works but in local it fails with above error.

We have the same problem with integration tests

Not sure if I am missing on something? Is it the problem with spring boot?

Its spring boot microservices.

We use codegen (group: 'io.swagger', name: 'swagger-codegen-cli', version: '2.3.0-SNAPSHOT', classifier: 'HATEOAS') { transitive = false } in source to generate client api.

Import api client in consumer service like

compile(group: 'com.xy.xy', name: 'product-service', version: '0.1.1', classifier: 'clientApi')

To make a patch call we use

productControllerApi.updateProductAssociationUsingPATCH(id, unitIds);
Vicky
  • 543
  • 1
  • 5
  • 15
  • 1
    How do you test your API? Can you share your client code? – Bunyamin Coskuner May 27 '19 at 05:55
  • @BunyaminCoskuner Its spring boot microservices. We use codegen (group: 'io.swagger', name: 'swagger-codegen-cli', version: '2.3.0-SNAPSHOT', classifier: 'HATEOAS') { transitive = false } in source to generate client api. Import api client in consumer service using compile(group: 'com.xy.xy', name: 'product-service', version: '0.1.1', classifier: 'clientApi') To make a patch call we use productControllerApi.updateProductAssociationUsingPATCH(id, unitIds); – Vicky May 27 '19 at 06:20
  • Does [this](https://stackoverflow.com/q/25163131/113116) help? – Helen May 27 '19 at 09:02
  • @Helen It doesn't help because I don't want to manually set the url. I just want to use client api. If I use RestTemplate.setRequestFactory(new HttpComponentsClientHttpRequestFactory() and use RestTemplate.exchange, its working. Just that the client-api is having the problem. That too in local and integration tests – Vicky May 27 '19 at 09:56

0 Answers0