我正在使用Resteasy客户端代理框架与REST API进行通信。我在代理接口上定义了一些方法,但不幸的是,在发送HTTP请求时,Content-Type未正确设置,这导致我收到http 400(错误请求)错误代码,因为远程API期望 Content-type头参数为application/json。
以下是示例:
有没有直接在代理接口级别上设置“Content-type”标头为“application/json”的方法?可以使用一些注解吗?
谢谢。
以下是示例:
@Path("/")
public interface RestAPIClient {
@POST
@Path("/send")
String send(@CookieParam("token") String token, @FormParam("name") String id, @FormParam("message") String message, @FormParam("emails") List<String> emails);
}
有没有直接在代理接口级别上设置“Content-type”标头为“application/json”的方法?可以使用一些注解吗?
谢谢。