{ "id": "133897", "key": "TIMOB-17467", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "17608", "name": "Release 6.1.0", "archived": false, "released": true, "releaseDate": "2017-05-26" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2016-08-29T21:34:59.000+0000", "created": "2014-07-30T10:37:07.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "TCSupport" ], "versions": [ { "id": "15422", "description": "Release 3.3.0", "name": "Release 3.3.0", "archived": false, "released": true, "releaseDate": "2014-07-16" } ], "issuelinks": [ { "id": "54273", "type": { "id": "10122", "name": "Gantt: start-finish", "inward": "is triggered by", "outward": "is triggering" }, "outwardIssue": { "id": "165945", "key": "TIMOB-24397", "fields": { "summary": "iOS: WebView - load a webpage with request headers", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "Critical", "id": "1" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2017-02-11T13:39:01.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" }, { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "h3. Steps to Reproduce\r\nThe concept is simple, to let user add custom headers to web view requests. Example:\r\n{code:javascript}\r\nvar webView = Ti.UI.createWebView();\r\nwebView.setHeaders({header1: 'Hello', header2: 'World'});\r\n{code}\r\nor directly during creation:\r\n{code:javascript}\r\nvar webView = Ti.UI.createWebView({\r\n headers: {header1: 'Hello', header2: 'World'}\r\n});\r\n{code}\r\n\r\nh3. Actual Result\r\nNo acces to web view headers, except for user-agent.\r\n\r\nh3. Expected Result\r\nCan add custom header to request.", "attachment": [ { "id": "60750", "filename": "IMG_0486.JPG", "author": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-11-21T18:54:00.000+0000", "size": 2409773, "mimeType": "image/jpeg" } ], "flagged": false, "summary": "iOS/Android: Expose request-headers for WebView", "creator": { "name": "tkrz", "key": "tkrz", "displayName": "Tomasz Krzywda", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "tkrz", "key": "tkrz", "displayName": "Tomasz Krzywda", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "317434", "author": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "body": "Thanks for your report. The priority will be set by the Platform team. ", "updateAuthor": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "created": "2014-08-07T02:06:42.000+0000", "updated": "2014-08-07T02:06:42.000+0000" }, { "id": "367639", "author": { "name": "nunocostapt", "key": "nunocostapt", "displayName": "Nuno Costa", "active": true, "timeZone": "Europe/Lisbon" }, "body": "Any update? There is any possibility to pass a custom referrer URL, like: https//:app.foo.com ? \r\nThanks", "updateAuthor": { "name": "nunocostapt", "key": "nunocostapt", "displayName": "Nuno Costa", "active": true, "timeZone": "Europe/Lisbon" }, "created": "2015-10-23T14:57:46.000+0000", "updated": "2015-10-23T14:57:46.000+0000" }, { "id": "367642", "author": { "name": "tkrz", "key": "tkrz", "displayName": "Tomasz Krzywda", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Sorry, unfortunately I am not working on that project anymore and I can't set up test env.", "updateAuthor": { "name": "tkrz", "key": "tkrz", "displayName": "Tomasz Krzywda", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-10-23T17:10:45.000+0000", "updated": "2015-10-23T17:10:45.000+0000" }, { "id": "375221", "author": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "body": "Started a fork:\r\n\r\nhttps://github.com/m1ga/titanium_mobile/commit/9555725b2fe532bd7f7c46a59fc911da9df6b6da\r\n\r\nyou can use it like this:\r\n\r\n{code:java}\r\n$.www.setHeader({\r\n \"User-Blub\": \"blablabla\",\r\n \"Referer\": \"http://www.test.de\"\r\n });\r\n{code}\r\n\r\nstill work in progress but my first tests are working", "updateAuthor": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-01-24T13:34:10.000+0000", "updated": "2016-01-24T13:34:10.000+0000" }, { "id": "381387", "author": { "name": "mano_mykingdom", "key": "mano_mykingdom", "displayName": "Manojkumar Murugesan", "active": true, "timeZone": "Asia/Kolkata" }, "body": "+1 for this feature.\r\n\r\nhttps://github.com/mano-mykingdom/titanium_mobile/commit/091149c94550acaac8acd1241db558fa3db2ce4b", "updateAuthor": { "name": "mano_mykingdom", "key": "mano_mykingdom", "displayName": "Manojkumar Murugesan", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2016-04-03T20:29:30.000+0000", "updated": "2016-04-03T20:29:30.000+0000" }, { "id": "393204", "author": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "body": "Cleaned Android PR version: https://github.com/appcelerator/titanium_mobile/pull/8230", "updateAuthor": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-08-15T19:53:10.000+0000", "updated": "2016-08-15T19:53:10.000+0000" }, { "id": "393417", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Parity-PR for iOS: https://github.com/appcelerator/titanium_mobile/pull/8239", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-08-17T20:45:48.000+0000", "updated": "2016-08-17T20:45:48.000+0000" }, { "id": "393418", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Assigning the review to Ash for Android. After merged, please re-assign the reviewer to [~apetkov] to review and merge the iOS-part. I will update the docs when everything is tested and merged.\r\n\r\nDemo for QE (should work cross-platform, [~michael] to confirm):\r\n{code:javascript}\r\nvar webView = Ti.UI.createWebView({\r\n\turl: \"https://httpbin.org/headers\",\r\n\trequestHeaders: {\r\n\t\t\"User-Blub\": \"blablabla\",\r\n\t\t\"Referer\": \"http://www.test.de\",\r\n\t\t\"something\": \"string1\",\r\n\t\t\"other\": \"string2\"\r\n\t}\r\n});\r\n\r\n/* Alternatively, use this setter\r\nwebView.setRequestHeaders({\r\n\t\"User-Blub\": \"blablabla\",\r\n\t\"Referer\": \"http://www.test.de\",\r\n\t\"something\": \"string1\",\r\n\t\"other\": \"string2\"\r\n});*/\r\n\r\nvar win = Ti.UI.createWindow();\r\nvar btn = Ti.UI.createButton({\r\n\ttitle : \"Reload\"\r\n});\r\n\r\nbtn.addEventListener(\"click\", function() {\r\n\twebView.reload();\r\n});\r\n\r\nwin.add(webView);\r\nwin.add(btn);\r\nwin.open();\r\n\r\nTi.API.warn(webView.requestHeaders);\r\nTi.API.warn(webView.getRequestHeaders());\r\nTi.API.warn(Object.keys(webView.requestHeaders).length);\r\n{code}", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-08-17T20:47:09.000+0000", "updated": "2016-08-17T21:39:58.000+0000" }, { "id": "393635", "author": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "updateAuthor": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-08-19T18:26:01.000+0000", "updated": "2016-08-19T18:26:01.000+0000" }, { "id": "394623", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "Android PR https://github.com/appcelerator/titanium_mobile/pull/8230 merged.\r\n[~hansknoechel]", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-08-29T08:22:02.000+0000", "updated": "2016-08-29T08:22:02.000+0000" }, { "id": "394628", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~apetkov] to review the iOS-PR.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-08-29T11:19:49.000+0000", "updated": "2016-08-29T11:19:49.000+0000" }, { "id": "401631", "author": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~hansknoechel]Attached is a screenshot on a device. Is this what is expected to be seen?\r\n!IMG_0486.JPG|thumbnail!", "updateAuthor": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-11-21T18:53:20.000+0000", "updated": "2016-11-21T18:56:10.000+0000" }, { "id": "401636", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Yes", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-11-21T19:23:36.000+0000", "updated": "2016-11-21T19:23:36.000+0000" }, { "id": "401706", "author": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Thanks, Hans. So I did verify that the feature works as expected with the following environment:\r\nNPM Version: 2.15.9\r\nNode Version: 4.5.0\r\nMac OS: 10.12.1\r\nAppc CLI: 6.0.0\r\nAppc CLI NPM: 4.2.8\r\nTitanium SDK version: 6.1.0.v20161122053743\r\nAppcelerator Studio, build: 4.8.0.201611121409\r\nXcode 8.1 GM\r\niOS Device: iOS 10.1.1\r\nAndroid Device: 6.0.1\r\n\r\nI tried the extended demo code provided by Michael G, and tried all three test scenarios. The following tests performed as expected on both the Android and iOS devices:\r\n1. requestHeaders property are set during creation \r\n2. custom headers survive a reload (press button reload, output stays the same)\r\n3. header can be changed with change header + reload to display the output\r\n\r\n", "updateAuthor": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-11-22T19:54:18.000+0000", "updated": "2016-11-22T19:54:18.000+0000" }, { "id": "406707", "author": { "name": "chris35", "key": "chris35", "displayName": "Christoph Eck", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hi\r\n\r\nI had several issues with the iOS implementation.\r\n\r\n# *A second POST request to the same address*: Because of the second loadUrlRequest call it could not send a second POST request. I mean the call \r\n{code}\r\n[self loadURLRequest:newRequest];\r\n{code}\r\n in the implementation. I made a fix for that see TIMOB-24329\r\nBut still this fix does not solve all request cycles propberly which can happen in a WebView itself.\r\n\r\n# *Own Request-Headers and Basic-Authentication-Headers*: I had a strange behaviour with including Basic Authentication and my own Request-Headers. It was difficult to determine the error but in the end I removed the second [self loadURLRequest:newRequest]; by setting the headers and Basic Authentication in the loadURLRequest itself. See at https://github.com/chreck/titanium_mobile/commit/4d67118bebe74e9c9f008df1e40327ffb44feb8e\r\n\r\nBest regards\r\n\r\nChristoph", "updateAuthor": { "name": "chris35", "key": "chris35", "displayName": "Christoph Eck", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-02-09T08:07:50.000+0000", "updated": "2017-02-09T08:07:50.000+0000" }, { "id": "406799", "author": { "name": "chris35", "key": "chris35", "displayName": "Christoph Eck", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hi\r\n\r\nI made a Jira about this issue. AC-4786\r\n\r\nBest regards\r\n\r\nChristoph", "updateAuthor": { "name": "chris35", "key": "chris35", "displayName": "Christoph Eck", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-02-10T13:00:39.000+0000", "updated": "2017-02-10T13:00:39.000+0000" } ], "maxResults": 16, "total": 16, "startAt": 0 } } }