Commit Graph

61 Commits

Author SHA1 Message Date
Damien Cassan 0bd97ecda2 feat(http): add options method to Http (#10540)
Add options method to the Http object, which could be useful when using self-describing RESTful APIs.

This closes #10500, closes #7918
2016-08-08 09:15:13 -07:00
Jason Choi 99989f5d3f chore(facade): remove most facade/async functions 2016-08-05 12:26:28 -07:00
Victor Berchet 13c8211065 fix: String.split(str, n) stops after n separator (#10408) 2016-08-01 11:33:35 -07:00
Cody-Nicholson 251953218c fix(http): URLSearchParams.clone propagate the QueryEncoder (#9900) 2016-07-30 19:01:20 -07:00
Zhicheng Wang 6134320f16 refactor(http): rewrite for readable & efficient. 2016-07-29 21:30:28 -07:00
Zhicheng Wang 7f647822bd fix(http): headers should be case-insensitive.
fixes #9452

spec at https://tools.ietf.org/html/rfc2616
2016-07-29 21:30:15 -07:00
Marc Laval f0bd528d77 test(http): fix Blob creation for Android <= 4.3
Closes #10377
2016-07-29 18:20:09 +02:00
Rob Wormald 422effdd18 refactor(http): use ngModules for http (#10329) 2016-07-27 13:09:05 -07:00
Jason Choi 64fc4648b7 fix(testing): correctly import NgMatchers (#10077)
Some test cases incorrectly rely on the side effect of other test cases
importing `NgMatchers`. This commit fixes this by making `expect` in
`core/testing_internal` properly typed.
2016-07-22 09:20:51 -07:00
Josh Gerdes bdb59129d0 feat(http): add content-type override support for http request (#10211) 2016-07-22 08:37:32 -07:00
Victor Berchet 00aa7a76b6 chore(tests): enable lint, make it green. (#10224) 2016-07-21 17:12:00 -07:00
Damien Cassan 76b8a49bfb feat(http): add support for blob as a response type (#10190) 2016-07-21 13:44:38 -07:00
Damien Cassan 83bc5c97ef fix(http): convert objects passed to requests into a string (#10124)
This remove a breaking change introduced with commit #e7a8e2757b06d572f614f53b648d2fd75df370d2 where json objects passed to  requests were not converted into string.

BREAKING CHANGE:

The behavior in this commit is the same as before PR 7260 : the objects sent with the request are converted to a string, therefore there is no need for the user to take care of the serialization.

Fixes #10073
2016-07-18 14:20:03 -07:00
Damien Cassan e7a8e2757b refactor(http): share 'body' logic between Request and Response 2016-07-12 18:01:06 -07:00
Damien Cassan 1266460386 feat(http): add support for ArrayBuffer
Add the buffer option to store response in ArrayBuffer
Improve the interface to get back response independently of the buffer type
2016-07-12 18:01:06 -07:00
Patrice Chalin 2708ce6a17 docs(api): fix links (#9852) 2016-07-06 14:34:27 -07:00
Naomi Black 9340e1b065 docs(security): security api doc update and fix stability marker for Type 2016-06-28 14:01:48 -07:00
Jeff Cross 1620426393 fix(http): don't encode values that are allowed in query (#9651)
This implements a new class, QueryEncoder, that provides
methods for encoding keys and values of query parameter.
The encoder encodes with encodeURIComponent, and then
decodes a whitelist of allowed characters back to their
unencoded form.

BREAKING CHANGE:

The changes to Http's URLSearchParams serialization now 
prevent encoding of these characters inside query parameters
which were previously converted to percent-encoded values:

@ : $ , ; + ; ? /

The default encoding behavior can be overridden by extending
QueryEncoder, as documented in the URLSearchParams service.

Fixes #9348
2016-06-28 11:31:35 -07:00
Igor Minar 24eb8389d2 fix: public api surface fixes + stability markers
- ts-api-guardian will now error if a new public symbol is added with a stability marker (`@stable`, `@experimental`, `@deprecated`)
- DomEventsPlugin and KeyEventsPlugin were removed from public api surface - these classes is an implementation detail
- deprecated BROWSER_PROVIDERS was removed completely
- `@angular/compiler` was removed from the ts-api-guardian check since this package shouldn't contain anything that users need to directly import
- the rest of the api surface was conservatively marked as stable or experimental

BREAKING CHANGES: DomEventsPlugin and KeyEventsPlugin previously exported from core are no longer public - these classes are implementation detail.

Previously deprecated BROWSER_PROVIDERS was completely removed from platform-browser.

Closes #9236
Closes #9235
Ref #9234
2016-06-28 07:39:40 -07:00
ScottSWu ae75e3640a chore(lint): Added license headers to most TypeScript files
Relates to #9380
2016-06-23 09:47:54 -07:00
Dmitry Zamula a5f2e205ef fix(http): add search param escaping for keys (#9166) 2016-06-22 18:23:15 -07:00
Victor Berchet 12c49042ab fix(HTTP/XhrBackend): correctly set the status code on errors (#9355)
fixes #9329
fixes angular/http#54
2016-06-20 15:02:14 -07:00
Alex Eagle 37b617dccf chore(tsickle): add @Annotation annotations
This lets users continue using runtime-sideeffect Decorators if they choose,
only down-leveling the marked ones to Annotations.

Also remove the "skipTemplateCodegen" option, which is no longer needed
since Angular compiles with tsc-wrapped rather than ngc. The former doesn't
include any codegen.
2016-06-16 12:29:46 -07:00
Vivek Ghaisas 537e99b4ea fix(http): respect custom Content-Type header in XHRConnection (#9131)
Fix a bug due to which setting a custom Content-Type header in the
Request led to multiple Content-Types being set on the sent
XMLHttpRequest: first the detected content type based on the request
body, followed by the custom set content type.

Fix #9130.
2016-06-10 08:18:49 -07:00
Alex Eagle f39c9c9e75 style(lint): re-format modules/@angular 2016-06-09 17:00:15 -07:00
Martin Probst 729dc3b764 fix(security): support XSSI prefixes with and without commas.
Some implementations use an XSSI prefix with a trailing comma, some without.
This changes Angular to support both.
2016-06-09 11:32:07 -07:00
Victor Berchet 7ce0fc7d47 refactor: add types (#9116) 2016-06-09 11:04:15 -07:00
ScottSWu 86fbd50c3d refactor(TypeScript): Add noImplicitAny
We automatically insert explicit 'any's where needed. These need to be
addressed as in #9100.

Fixes #4924
2016-06-08 16:20:50 -07:00
Igor Minar 29c2dcff61 fix(http): remove peerDep on @angular/common
it is not needed there because it will get transitively installed by @angular/platform-browser

we only need to declare this dependency in tsconfig.json because tsconfig.json's
do not support transitive dependencies in this way.
2016-06-08 12:20:42 -07:00
Igor Minar d18694a1c3 Revert "WIP: test: add tree-shaking test (#8979)"
This reverts commit b746c64229.

Reason: bad merge via github ui
2016-06-08 12:20:17 -07:00
Igor Minar b746c64229 WIP: test: add tree-shaking test (#8979)
* test: add tree-shaking test

currently this doesn't throw or break the build, first we need to resolve all
of the existing issues.

to run execute: ./tools/tree-shaking-test/test.sh

then inspect dist/tree-shaking/test/**/*.bundle.js

* fix(http): remove peerDep on @angular/common

it is not needed there because it will get transitively installed by @angular/platform-browser

we only need to declare this dependency in tsconfig.json because tsconfig.json's
do not support transitive dependencies in this way.
2016-06-08 12:15:09 -07:00
Victor Berchet ac1156739d feat(i18n): extract messages 2016-06-07 15:17:02 -07:00
Victor Berchet a6ad61d83e refactor: change provide(...) for {provide: ...}
- provide() is deprecated,
- {} syntax is required by the offline compiler
2016-06-03 15:03:49 -07:00
Victor Berchet 27a47e7841 refactor(imports): simplify paths 2016-06-03 14:46:04 -07:00
Martin Probst 10475b859d chore: remove deep imports to fix build. 2016-05-31 17:13:41 -07:00
Martin Probst 4d793c4eb8 feat(security): Automatic XSRF handling.
Automatically recognize XSRF protection cookies, and set a corresponding XSRF
header. Allows applications to configure the cookie names, or if needed,
completely override the XSRF request configuration by binding their own
XSRFHandler implementation.

Part of #8511.
2016-05-31 16:12:33 -07:00
Alex Eagle c6064a30a1 chore(package.json): make the packages installable 2016-05-27 17:21:34 -07:00
Phong Huynh ec198b0dc6 docs(MockConnection) add mockError usage example (#8888) 2016-05-27 10:10:53 -07:00
Alex Eagle 2019050db2 chore(lint): enable duplicateModuleImport tslint check 2016-05-27 09:17:08 -07:00
Thierry Templier 89f61087c7 feat(http): implement Response.prototype.toString() to make for a nicer error message
Added a toString method to the Response class displaying status / status and
the URL of the request.

Closes: https://github.com/angular/http/issues/89

Closes #7511
2016-05-26 10:38:29 -07:00
Igor Minar 16dfe3c63f build: consolidate tsc to ease migration to @types/ based typings delivery
I actually tried to use @types/* directly but came across several issues which prevented me
from switching over:
- https://github.com/Microsoft/TypeScript/issues/8715
- https://github.com/Microsoft/TypeScript/issues/8723
2016-05-25 08:22:07 -07:00
Utsav Shah 92340350d2 fix(http): Set response.ok
The ok property was not being set on response objects.
It's now set based on the status code.

Closes #6390
Closes #6503
2016-05-24 21:20:27 -07:00
Thierry Templier 95af14b97c feat(http): added withCredentials support
Taken into account the withCredentials property within the request options:
- added corresponding property in the RequestOptions class
- added corresponding property in the Request class
- handle this property when merging options
- set the withCredentials property on the XHR object when specified

Added a test in the xhr_backend_spec.ts to check that the property is actually
set on the XHR object

Closes https://github.com/angular/http/issues/65

Closes #7281

Closes #7281
2016-05-24 11:53:43 -07:00
Thierry Templier 0f0a8ade7c feat(http): automatically set request Content-Type header based on body type
Implement the ability to provide objects as request body. The following use cases
are supported:
* raw objects: a JSON payload is created and the content type set to `application/json`
* text: the text is used as it is and no content type header is automatically added
* URLSearchParams: a form payload is created and the content type set to `application/x-www-form-urlencoded`
* FormData: the object is used as it is and no content type header is automatically added
* Blob: the object is used as it is and the content type set with the value of its `type` property if any
* ArrayBuffer: the object is used as it is and no content type header is automatically added

Closes https://github.com/angular/http/issues/69

Closes #7310
2016-05-24 11:42:37 -07:00
Kevin-K 17f73cb7bc docs(http): fix MockBackend example
imports & syntax error fix

Closes #7383
2016-05-23 17:22:36 -07:00
Pete Boere 6f3a6a55a0 Update url_search_params.ts
Values need to be encoded on `toString()`
Closes #7686
2016-05-23 14:43:26 -07:00
Elliott Davis b2e0946696 fix(Request): Change Request.text's return type to string
Change the return typing for the .text method to `string` so typescript treats it
like a normal string.

Closes #8138
2016-05-20 12:57:31 -07:00
Igor Minar 0035575c82 build: turn on tsc's stripInternal when producint public d.ts file
I also made some changes to fix imports and remove some stuff that caused
breakage once stripInternals was turned on.
2016-05-20 10:59:57 -07:00
agpreynolds 3857c8226e docs(MockConnection) update mockRespond usage example (#8487)
Closes: #8486
2016-05-20 09:19:59 -07:00
Rob Wormald aec95015f8 docs(http): update http docs to mention .map operator
Closes #5947
2016-05-19 22:15:26 -07:00