【问题标题】:ContentType is null when making Get requests using ServiceStack JsonServiceClient使用 ServiceStack JsonServiceClient 发出 Get 请求时,ContentType 为空
【发布时间】:2015-03-10 17:00:41
【问题描述】:

在我的集成测试中,当我使用 ServiceStack 的 JsonServiceClient 发出 Get 请求时,ContentType 为空。然而,所有的 Post 请求都有一个 ContentType。是故意排除的吗? IE。 Do I need a content type for http get requests?

有没有办法可以使用此客户端设置 ContentType?

【问题讨论】:

    标签: servicestack


    【解决方案1】:

    GET 请求没有Content-Type,因为它没有请求正文。

    请求标头上的Content-Type 指定请求正文的格式,同样,响应正文上的Content-Type 指定响应正文的格式。

    您可能会在 Accept HTTP 请求标头之后,它告诉服务器它希望响应的首选内容类型。

    【讨论】:

      猜你喜欢
      • 2016-12-29
      • 2021-12-03
      • 2017-11-22
      • 1970-01-01
      • 2021-12-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多