Uploaded image for project: 'Weex (Retired)'
  1. Weex (Retired)
  2. WEEX-431

android stream module lost response headers when header's value is a list

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • Android

    Description

      code file: https://github.com/apache/incubator-weex/blob/master/android/sdk/src/main/java/com/taobao/weex/http/WXStreamModule.java

      line: 328

       

       

      //code from WXStreamModule.java 
      if (headers != null) {
        Iterator<Map.Entry<String, List<String>>> it =   headers.entrySet().iterator();
        while (it.hasNext()) {
          Map.Entry<String, List<String>> entry = it.next();
          if (entry.getValue().size() > 0) {
            simpleHeaders.put(entry.getKey() == null ? "_" : entry.getKey(),   entry.getValue().get(0));
          }
        }
      }
      

      In the codes above, simpleHeaders only save the first element from header's value list, others will be ignored. Think about the case below: 

      Response headers:

      Set-Cookie: x=1;
      Set-Cookie: y=2;
      ......

      the cookie value `y=2` will be lost.

       

      Attachments

        Activity

          People

            codefurture codefurture
            liuyunwei 刘大卫
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: