spring resttemplate invalidmediatypeexception由于令牌中的令牌字符'@'无效,mime类型无效

ryevplcw  于 2021-07-23  发布在  Java
关注(0)|答案(0)|浏览(149)

我调用的api响应的内容类型 @ 在响应restemplate调用的值中。

final HttpHeaders headers = new HttpHeaders();
        headers.set(HttpHeaders.ACCEPT, "key=abcd@def");
        final ResponseEntity<String> responseEntity = resttemplate.exchange(
                path, HttpMethod.GET, new HttpEntity<>(null, headers),
                String.class);
Response Header
content-type: key=abc@def

我得到的错误

org.springframework.http.InvalidMediaTypeException: 
Invalid mime type "key=abcd@def": Invalid token character '@' in token "abcd@def"

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题