Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-7825] MobileWeb: Expose withCredentials and userAgent on HTTPClient

GitHub Issuen/a
TypeNew Feature
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-03-19T22:44:49.000+0000
Affected Version/sRelease 2.0.0
Fix Version/sRelease 2.0.0, Sprint 2012-06
ComponentsMobileWeb
Labelsn/a
ReporterDawson Toth
AssigneeChris Barber
Created2012-02-27T11:20:56.000+0000
Updated2017-03-04T00:17:31.000+0000

Description

Feature

Two properties are needed for a particular instance of cross domain requesting: - Expose the withCredentials property of XMLHttpRequest via HTTPClient. - Allow overriding or excluding the UserAgent request header via a userAgent property passed in the constructor.

Why

For some cross domain requests, these properties need to be set, or the request won't be valid. (Cookies and authorization need to be included, and the server doesn't accept the UserAgent header.)

Comments

  1. Dawson Toth 2012-02-27

    PR sent: https://github.com/appcelerator/titanium_mobile/pull/1519
  2. Chris Barber 2012-02-27

    Do we need this? We've been testing with cross-domain XHR and it works as long as the server has properly configured CORS (cross-origin resource sharing). Furthermore, this should probably be implemented as a property, not a method. A "withCreditials" will automatically create the setter/getter method.
  3. Chris Barber 2012-02-27

    Is there any reason we can't always set setWithCredentials('true')?
  4. Chris Barber 2012-02-27

    What is the fallback for browsers that don't support XHR2 (i.e. support for setWithCredentials())?
  5. Dawson Toth 2012-02-27

    PR updated per your comments. To the best of my knowledge, browsers that don't support XHR2 will ignore the property. We probably could set withCredentials to true all the time, but I think it would only be a problem if the server wasn't sending "Access-Control-Allow-Credentials: true".
  6. Bryan Hughes 2012-03-19

    Pull Request: https://github.com/appcelerator/titanium_mobile/pull/1749 Note: we removed support for Ti.userAgent entirely, and are no longer setting the "UserAgent" header internally.
  7. Lee Morris 2017-03-04

    Closing ticket due to MobileWeb no longer being supported.

JSON Source