FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Multiple HTTP response headers not returned correctly on Android · Issue #2413 · NativeScript/NativeScript · GitHub

Multiple HTTP response headers not returned correctly on Android #2413

Description

Which platform(s) does your issue occur on?

Android

Please provide the following version numbers that your issue occurs with:

  • CLI: 2.1
  • Cross-platform modules: 2.1
  • Runtime(s): 2.1.1

Please tell us how to recreate the issue in as much detail as possible.

I am attaching a sample project.

  • Run server with npm run start
  • Adjust server IP for your emulator/device in app.component.ts.
  • Run client app with cd header-test; tns run android
  • Tap the button - it will issue a HTTP request

The node server will return a response that has two Header1 headers set. The correct implementation should return a ["one", "two"] value when requesting the headers. It returns ["two", "two"] instead.

It seems the Java HTTP library we use for Android returns the wrong value. Adding a log statement to header extraction:

    if (result.headers) {
        var jHeaders = result.headers;
        var length = jHeaders.size();
        var i;
        var pair;
        for (i = 0; i < length; i++) {
            pair = jHeaders.get(i);
            console.log("GOT HEADER: " + pair.key + " = " + pair.value);
            http.addHeader(headers, pair.key, pair.value);
        }
    }

Yields this:

JS: GOT HEADER: Header1 = two
JS: GOT HEADER: Header1 = two

http-headers.zip

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL