zoukankan      html  css  js  c++  java
  • 使用rest-assured测试rest service, 遇到“415 Unsupported Media Type”

    问题:使用rest-assured测试rest service, 遇到“415 Unsupported Media Type”

    Appserver的log:
    [6/18/15 21:35:31:961 CDT] 0000001d org.apache.wink.server.internal.RequestProcessor I The following error occurred during the invocation of the handlers chain: WebApplicationException (415 - Unsupported Media Type) with message 'null' while processing DELETE request sent to http://......

    但是在脚本里是设了Content-Type的,这是控制台打出的log:

    Request method: DELETE
    Request path: http://......
    Proxy: <none>
    Request params: <none>
    Query params: _informat=json
    Form params: <none>
    Path params: storeId=DEFAULT
    orderId=201506172121484931
    Multiparts: <none>
    Headers: Content-Type=application/json; charset=UTF-8
    Authorization=Bearer b9368eb9-1788-41d1-844e-7df07dac3a5a
    Cookies: <none>
    Body: <none>
    HTTP/1.1 415 Unsupported Media Type
    X-Powered-By: Servlet/3.0
    X-FRAME-OPTIONS: SAMEORIGIN
    X-UA-Compatible: IE=EmulateIE8
    Set-Cookie: rememberMe=deleteMe; Path=/smcfs; Max-Age=0; Expires=Wed, 17-Jun-2015 02:20:47 GMT
    Content-Language: en-US
    Content-Length: 0
    Connection: Close
    Date: Thu, 18 Jun 2015 02:20:46 GMT
    Expires: Thu, 01 Dec 1994 16:00:00 GMT
    Cache-Control: no-cache="set-cookie, set-cookie2"

    百思不得其解,最后在rest-assured的问题列表里发现了这个 Issue 362: Content-Type seems to work in console out, but it's not really working (https://code.google.com/p/rest-assured/issues/detail?id=362)


    把rest-assured从2.3.2升级到2.4.0,问题解决。

  • 相关阅读:
    SpringMVC在使用Jackson2时关于日期类型格式化的问题
    Redis入门到高可用(八)——list
    LongAdder,AtomicIntegerFieldUpdater深入研究
    Redis入门到高可用(七)——Hash
    CAS缺点
    MySQL 当记录不存在时插入(insert if not exists)
    Redis入门到高可用(六)—— 字符串
    jsonp 跨域
    jvm
    指令重排序
  • 原文地址:https://www.cnblogs.com/qdlk/p/4588075.html
Copyright © 2011-2022 走看看