apache / apache/servicecomb-java-chassis

servicecomb not support patchForObject

Open
#2,649 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
1.9k
Forks
814
Avg merge
8d 23h
Merged PRs (30d)
1

Description

### 使用RestTemplateBuilder.create()创建出来的restTemplate无法通过patchForObject发送patch请求
请求示例
```
restTemplate.patchForObject("cse://test-provider2/provider/tomcat/patch", httpEntity, Map.class);
```
异常如下
```
2021-12-02 10:08:18.361 ERROR 1008 --- [oup0-1-thread-1] o.a.s.c.h.impl.ProducerOperationHandler : unexpected error operation=PRODUCER rest test-consumer2.helloConsumer.sayHello, message=null, cause=I/O error on PATCH request for "cse://test-provider2/provider/tomcat/patch": Null OutputStream is not a valid argument; nested exception is com.fasterxml.jackson.core.JsonGenerationException: Null OutputStream is not a valid argument
```
### 报错原因
org.apache.servicecomb.provider.springmvc.reference.CseClientHttpRequest 类的public OutputStream getBody() 这个方法return为null

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with org.apache.servicecomb.provider.springmvc.reference.CseClientHttpRequest, especially its getBody() method, and reproduce the RestTemplateBuilder.create() call followed by patchForObject(). Trace how the PATCH request obtains its body output stream. Done means the example PATCH request succeeds without the Null OutputStream or JsonGenerationException error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.