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

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

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: 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

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

              Dates

              • Created:
                Updated: