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

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

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

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

我得到的错误

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

暂无答案!

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

相关问题