Skip to content
This repository has been archived by the owner on Sep 26, 2022. It is now read-only.

Response headers on Android have extra spaces and commas #63

Closed
6c65726f79 opened this issue Oct 27, 2020 · 4 comments
Closed

Response headers on Android have extra spaces and commas #63

6c65726f79 opened this issue Oct 27, 2020 · 4 comments

Comments

@6c65726f79
Copy link

Describe the bug
Hello, I think there's a bug with the returned headers values on Android, there's a comma and a space added at the end of every values. This can be problematic when retrieving a token from the response header.
I haven't tested on iOS so I don't know if it's a bug specific to Android.

Response headers in browser/Electron :

{
	content-length: "581"
	content-type: "text/html; charset=ISO-8859-1"
	date: "Tue, 27 Oct 2020 15:03:01 GMT"
	server: "Transmission"
	x-transmission-session-id: "xxxxxxxxxx"
}

Response headers in Android app :

[
	{},
	{"Content-Length":"581, "},
	{"Content-Type":"text/html; charset=ISO-8859-1, "},
	{"Date":"Tue, 27 Oct 2020 15:08:20 GMT, "},
	{"Server":"Transmission, "},
	{"X-Android-Received-Millis":"1603811299594, "},
	{"X-Android-Response-Source":"NETWORK 409, "},
	{"X-Android-Selected-Protocol":"http/1.1, "},
	{"X-Android-Sent-Millis":"1603811299593, "},
	{"X-Transmission-Session-Id":"xxxxxxxxxx, "}
]

To Reproduce

const ret = await Http.request({
    method: 'GET',
    url: 'https://example.com/my/api'
});
console.log(ret.headers);

Expected behavior
There shouldn't be content added at the end of the values.

Screenshots
Browser log:
capacitor-bug2

Android Studio log:
capacitor-bug3

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: Google Chrome
  • Version: 86.0.4240.111

Smartphone (please complete the following information):

  • Device: Pixel 3
  • OS: Android 11
  • Browser: Android Webview (capacitor)
  • Version: 2.4.2

Additional context
I'm using SDK for Android 11 (API level 30) to build the app.

@thomasvidas
Copy link
Contributor

I believe this is a duplicate of #32. Closing this issue in favor of that one

@6c65726f79
Copy link
Author

No this is not the same issue, they occur in the same case but in the other issue he doesn't mention this problem. I'm talking about the comma added at the end of every values on Android.

@thomasvidas
Copy link
Contributor

Ah I understand. Gotcha 👍 . I'll reopen then

@thomasvidas thomasvidas reopened this Jan 21, 2021
@thomasvidas thomasvidas changed the title Problem with the values of the response headers on android Response headers on Android have extra spaces and commas Jan 21, 2021
Landschaft pushed a commit to ergon/http that referenced this issue Jan 29, 2021
…e header container from JSArray to JSObject

This is to adhere to the interface `HttpResponse` defined in `definitions.ts`.
@thomasvidas
Copy link
Contributor

Fixed by #99

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants