Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

$xhr posts JSON data as form-urlencoded #395

Closed
efleming969 opened this issue Jun 17, 2011 · 1 comment
Closed

$xhr posts JSON data as form-urlencoded #395

efleming969 opened this issue Jun 17, 2011 · 1 comment

Comments

@efleming969
Copy link

When posting an object via $xhr

$xhr('/some/uri', 'POST', {some:'object'});

The default behavior is to encode that object as JSON. This would be fine if the default Content-Type of $browser.xhr was application/json, but it's application/x-www-form-urlencoded.

Since you can't set the Content-Type via $xhr (see #180), then this feature is virtually unusable, confusing and probably an inappropriate default.

Solution is to urlencode the object instead of JSON

@IgorMinar
Copy link
Contributor

as of 0.9.17 you can override the default headers, and we do plan to make further changes to deal with this better, but giving the flexibility to change headers is the first step.

vojtajina added a commit to vojtajina/angular.js that referenced this issue Aug 12, 2011
Features:
- aborting requests
- more flexible callbacks (per status code)
- custom request headers (per request)
- access to response headers
- custom transform functions (both request, response)
- caching
- shortcut methods (get, head, post, put, delete, patch, jsonp)
- exposing pendingCount()

Breaks Takes one parameter now - configuration object
Breaks $xhr.cache removed - use configuration cache: true instead
Breaks $xhr.error, $xhr.bulk removed
Breaks Callback functions accepts parameters: response, status, headers

Closes angular#38
Closes angular#80
Closes angular#180
Closes angular#299
Closes angular#342
Closes angular#395
Closes angular#413
Closes angular#414
Closes angular#507
vojtajina added a commit to vojtajina/angular.js that referenced this issue Aug 23, 2011
Features:
- aborting requests
- more flexible callbacks (per status code)
- custom request headers (per request)
- access to response headers
- custom transform functions (both request, response)
- caching
- shortcut methods (get, head, post, put, delete, patch, jsonp)
- exposing pendingCount()
- setting timeout

Breaks renaming $xhr to $http
Breaks Takes one parameter now - configuration object
Breaks $xhr.cache removed - use configuration cache: true instead
Breaks $xhr.error, $xhr.bulk removed
Breaks Callback functions accepts parameters: response, status, headers

Closes angular#38
Closes angular#80
Closes angular#180
Closes angular#299
Closes angular#342
Closes angular#395
Closes angular#413
Closes angular#414
Closes angular#507
vojtajina added a commit to vojtajina/angular.js that referenced this issue Sep 2, 2011
Features:
- aborting requests
- more flexible callbacks (per status code)
- custom request headers (per request)
- access to response headers
- custom transform functions (both request, response)
- caching
- shortcut methods (get, head, post, put, delete, patch, jsonp)
- exposing pendingCount()
- setting timeout

Breaks renaming $xhr to $http
Breaks Takes one parameter now - configuration object
Breaks $xhr.cache removed - use configuration cache: true instead
Breaks $xhr.error, $xhr.bulk removed
Breaks Callback functions accepts parameters: response, status, headers

Closes angular#38
Closes angular#80
Closes angular#180
Closes angular#299
Closes angular#342
Closes angular#395
Closes angular#413
Closes angular#414
Closes angular#507
IgorMinar pushed a commit to IgorMinar/angular.js that referenced this issue Oct 21, 2011
Features:
- aborting requests
- more flexible callbacks (per status code)
- custom request headers (per request)
- access to response headers
- custom transform functions (both request, response)
- caching
- shortcut methods (get, head, post, put, delete, patch, jsonp)
- exposing pendingCount()
- setting timeout
Breaks renaming $xhr to $http
Breaks Takes one parameter now - configuration object
Breaks $xhr.cache removed - use configuration cache: true instead
Breaks $xhr.error, $xhr.bulk removed
Breaks Callback functions accepts parameters: response, status, headers
Closes angular#38
Closes angular#80
Closes angular#180
Closes angular#299
Closes angular#342
Closes angular#395
Closes angular#413
Closes angular#414
Closes angular#507
vojtajina added a commit to vojtajina/angular.js that referenced this issue Oct 27, 2011
Features:
- aborting requests
- more flexible callbacks (per status code)
- custom request headers (per request)
- access to response headers
- custom transform functions (both request, response)
- caching
- shortcut methods (get, head, post, put, delete, patch, jsonp)
- exposing pendingCount()
- setting timeout
Breaks renaming $xhr to $http
Breaks Takes one parameter now - configuration object
Breaks $xhr.cache removed - use configuration cache: true instead
Breaks $xhr.error, $xhr.bulk removed
Breaks Callback functions accepts parameters: response, status, headers
Closes angular#38
Closes angular#80
Closes angular#180
Closes angular#299
Closes angular#342
Closes angular#395
Closes angular#413
Closes angular#414
Closes angular#507
vojtajina added a commit to vojtajina/angular.js that referenced this issue Nov 21, 2011
Features:
- aborting requests
- more flexible callbacks (per status code)
- custom request headers (per request)
- access to response headers
- custom transform functions (both request, response)
- caching
- shortcut methods (get, head, post, put, delete, patch, jsonp)
- exposing pendingCount()
- setting timeout
Breaks Renaming $xhr to $http
Breaks Takes one parameter now - configuration object
Breaks $xhr.cache removed - use configuration cache: true instead
Breaks $xhr.error, $xhr.bulk removed
Breaks Callback functions get parameters: response, status, headers
Closes angular#38
Closes angular#80
Closes angular#180
Closes angular#299
Closes angular#342
Closes angular#395
Closes angular#413
Closes angular#414
Closes angular#507
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants