@cratis/arc 20.55.1 → 20.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Globals.ts +15 -0
- package/dist/cjs/Globals.js +2 -0
- package/dist/cjs/Globals.js.map +1 -1
- package/dist/cjs/queries/ObservableQueryFor.js +13 -23
- package/dist/cjs/queries/ObservableQueryFor.js.map +1 -1
- package/dist/cjs/queries/QueryFor.js +13 -25
- package/dist/cjs/queries/QueryFor.js.map +1 -1
- package/dist/cjs/queries/QueryHttpMethod.js +23 -0
- package/dist/cjs/queries/QueryHttpMethod.js.map +1 -0
- package/dist/cjs/queries/QueryHttpMethodResolver.js +25 -0
- package/dist/cjs/queries/QueryHttpMethodResolver.js.map +1 -0
- package/dist/cjs/queries/QueryHttpRequest.js +0 -0
- package/dist/cjs/queries/QueryHttpRequest.js.map +1 -0
- package/dist/cjs/queries/index.js +9 -0
- package/dist/cjs/queries/index.js.map +1 -1
- package/dist/esm/Globals.d.ts +4 -0
- package/dist/esm/Globals.d.ts.map +1 -1
- package/dist/esm/Globals.js +2 -0
- package/dist/esm/Globals.js.map +1 -1
- package/dist/esm/queries/IQuery.d.ts +2 -0
- package/dist/esm/queries/IQuery.d.ts.map +1 -1
- package/dist/esm/queries/ObservableQueryFor.d.ts +3 -0
- package/dist/esm/queries/ObservableQueryFor.d.ts.map +1 -1
- package/dist/esm/queries/ObservableQueryFor.js +13 -23
- package/dist/esm/queries/ObservableQueryFor.js.map +1 -1
- package/dist/esm/queries/QueryFor.d.ts +3 -0
- package/dist/esm/queries/QueryFor.d.ts.map +1 -1
- package/dist/esm/queries/QueryFor.js +13 -25
- package/dist/esm/queries/QueryFor.js.map +1 -1
- package/dist/esm/queries/QueryHttpMethod.d.ts +6 -0
- package/dist/esm/queries/QueryHttpMethod.d.ts.map +1 -0
- package/dist/esm/queries/QueryHttpMethod.js +21 -0
- package/dist/esm/queries/QueryHttpMethod.js.map +1 -0
- package/dist/esm/queries/QueryHttpMethodResolver.d.ts +14 -0
- package/dist/esm/queries/QueryHttpMethodResolver.d.ts.map +1 -0
- package/dist/esm/queries/QueryHttpMethodResolver.js +22 -0
- package/dist/esm/queries/QueryHttpMethodResolver.js.map +1 -0
- package/dist/esm/queries/QueryHttpRequest.d.ts +21 -0
- package/dist/esm/queries/QueryHttpRequest.d.ts.map +1 -0
- package/dist/esm/queries/QueryHttpRequest.js +0 -0
- package/dist/esm/queries/QueryHttpRequest.js.map +1 -0
- package/dist/esm/queries/for_QueryFor/when_performing/with_query_http_method.d.ts +2 -0
- package/dist/esm/queries/for_QueryFor/when_performing/with_query_http_method.d.ts.map +1 -0
- package/dist/esm/queries/for_QueryFor/when_performing/with_query_http_method.js +51 -0
- package/dist/esm/queries/for_QueryFor/when_performing/with_query_http_method.js.map +1 -0
- package/dist/esm/queries/for_buildQueryHttpRequest/when_building/with_get_method.d.ts +2 -0
- package/dist/esm/queries/for_buildQueryHttpRequest/when_building/with_get_method.d.ts.map +1 -0
- package/dist/esm/queries/for_buildQueryHttpRequest/when_building/with_get_method.js +23 -0
- package/dist/esm/queries/for_buildQueryHttpRequest/when_building/with_get_method.js.map +1 -0
- package/dist/esm/queries/for_buildQueryHttpRequest/when_building/with_query_method.d.ts +2 -0
- package/dist/esm/queries/for_buildQueryHttpRequest/when_building/with_query_method.d.ts.map +1 -0
- package/dist/esm/queries/for_buildQueryHttpRequest/when_building/with_query_method.js +28 -0
- package/dist/esm/queries/for_buildQueryHttpRequest/when_building/with_query_method.js.map +1 -0
- package/dist/esm/queries/for_buildQueryHttpRequest/when_building/with_query_method_and_paging_and_sorting.d.ts +2 -0
- package/dist/esm/queries/for_buildQueryHttpRequest/when_building/with_query_method_and_paging_and_sorting.d.ts.map +1 -0
- package/dist/esm/queries/for_buildQueryHttpRequest/when_building/with_query_method_and_paging_and_sorting.js +26 -0
- package/dist/esm/queries/for_buildQueryHttpRequest/when_building/with_query_method_and_paging_and_sorting.js.map +1 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/options.d.ts +3 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/options.d.ts.map +1 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/options.js +16 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/options.js.map +1 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_a_resolver.d.ts +2 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_a_resolver.d.ts.map +1 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_a_resolver.js +23 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_a_resolver.js.map +1 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_a_resolver_and_an_explicit_override.d.ts +2 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_a_resolver_and_an_explicit_override.d.ts.map +1 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_a_resolver_and_an_explicit_override.js +23 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_a_resolver_and_an_explicit_override.js.map +1 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_auto_after_query_was_found_unsupported.d.ts +2 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_auto_after_query_was_found_unsupported.d.ts.map +1 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_auto_after_query_was_found_unsupported.js +21 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_auto_after_query_was_found_unsupported.js.map +1 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_auto_and_a_network_failure.d.ts +2 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_auto_and_a_network_failure.d.ts.map +1 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_auto_and_a_network_failure.js +23 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_auto_and_a_network_failure.js.map +1 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_auto_and_an_aborted_request.d.ts +2 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_auto_and_an_aborted_request.d.ts.map +1 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_auto_and_an_aborted_request.js +25 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_auto_and_an_aborted_request.js.map +1 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_auto_and_an_application_error.d.ts +2 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_auto_and_an_application_error.d.ts.map +1 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_auto_and_an_application_error.js +21 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_auto_and_an_application_error.js.map +1 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_auto_and_multiple_backends.d.ts +2 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_auto_and_multiple_backends.d.ts.map +1 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_auto_and_multiple_backends.js +31 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_auto_and_multiple_backends.js.map +1 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_auto_and_query_supported.d.ts +2 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_auto_and_query_supported.d.ts.map +1 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_auto_and_query_supported.js +19 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_auto_and_query_supported.js.map +1 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_auto_and_query_unsupported.d.ts +2 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_auto_and_query_unsupported.d.ts.map +1 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_auto_and_query_unsupported.js +22 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_auto_and_query_unsupported.js.map +1 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_get_method.d.ts +2 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_get_method.d.ts.map +1 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_get_method.js +19 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_get_method.js.map +1 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_query_method_and_server_rejecting_the_verb.d.ts +2 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_query_method_and_server_rejecting_the_verb.d.ts.map +1 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_query_method_and_server_rejecting_the_verb.js +19 -0
- package/dist/esm/queries/for_executeQueryHttpRequest/when_performing/with_query_method_and_server_rejecting_the_verb.js.map +1 -0
- package/dist/esm/queries/for_lengthBasedQueryHttpMethod/when_resolving/with_a_long_url.d.ts +2 -0
- package/dist/esm/queries/for_lengthBasedQueryHttpMethod/when_resolving/with_a_long_url.d.ts.map +1 -0
- package/dist/esm/queries/for_lengthBasedQueryHttpMethod/when_resolving/with_a_long_url.js +12 -0
- package/dist/esm/queries/for_lengthBasedQueryHttpMethod/when_resolving/with_a_long_url.js.map +1 -0
- package/dist/esm/queries/for_lengthBasedQueryHttpMethod/when_resolving/with_a_long_url_and_a_custom_method.d.ts +2 -0
- package/dist/esm/queries/for_lengthBasedQueryHttpMethod/when_resolving/with_a_long_url_and_a_custom_method.d.ts.map +1 -0
- package/dist/esm/queries/for_lengthBasedQueryHttpMethod/when_resolving/with_a_long_url_and_a_custom_method.js +12 -0
- package/dist/esm/queries/for_lengthBasedQueryHttpMethod/when_resolving/with_a_long_url_and_a_custom_method.js.map +1 -0
- package/dist/esm/queries/for_lengthBasedQueryHttpMethod/when_resolving/with_a_short_url.d.ts +2 -0
- package/dist/esm/queries/for_lengthBasedQueryHttpMethod/when_resolving/with_a_short_url.d.ts.map +1 -0
- package/dist/esm/queries/for_lengthBasedQueryHttpMethod/when_resolving/with_a_short_url.js +11 -0
- package/dist/esm/queries/for_lengthBasedQueryHttpMethod/when_resolving/with_a_short_url.js.map +1 -0
- package/dist/esm/queries/index.d.ts +3 -0
- package/dist/esm/queries/index.d.ts.map +1 -1
- package/dist/esm/queries/index.js +3 -0
- package/dist/esm/queries/index.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/queries/IQuery.ts +7 -0
- package/queries/ObservableQueryFor.ts +16 -25
- package/queries/QueryFor.ts +16 -27
- package/queries/QueryHttpMethod.ts +24 -0
- package/queries/QueryHttpMethodResolver.ts +51 -0
- package/queries/QueryHttpRequest.ts +0 -0
- package/queries/for_QueryFor/when_performing/with_query_http_method.ts +63 -0
- package/queries/for_buildQueryHttpRequest/when_building/with_get_method.ts +31 -0
- package/queries/for_buildQueryHttpRequest/when_building/with_query_method.ts +42 -0
- package/queries/for_buildQueryHttpRequest/when_building/with_query_method_and_paging_and_sorting.ts +35 -0
- package/queries/for_executeQueryHttpRequest/options.ts +24 -0
- package/queries/for_executeQueryHttpRequest/when_performing/with_a_resolver.ts +31 -0
- package/queries/for_executeQueryHttpRequest/when_performing/with_a_resolver_and_an_explicit_override.ts +31 -0
- package/queries/for_executeQueryHttpRequest/when_performing/with_auto_after_query_was_found_unsupported.ts +33 -0
- package/queries/for_executeQueryHttpRequest/when_performing/with_auto_and_a_network_failure.ts +31 -0
- package/queries/for_executeQueryHttpRequest/when_performing/with_auto_and_an_aborted_request.ts +31 -0
- package/queries/for_executeQueryHttpRequest/when_performing/with_auto_and_an_application_error.ts +29 -0
- package/queries/for_executeQueryHttpRequest/when_performing/with_auto_and_multiple_backends.ts +43 -0
- package/queries/for_executeQueryHttpRequest/when_performing/with_auto_and_query_supported.ts +26 -0
- package/queries/for_executeQueryHttpRequest/when_performing/with_auto_and_query_unsupported.ts +30 -0
- package/queries/for_executeQueryHttpRequest/when_performing/with_get_method.ts +26 -0
- package/queries/for_executeQueryHttpRequest/when_performing/with_query_method_and_server_rejecting_the_verb.ts +26 -0
- package/queries/for_lengthBasedQueryHttpMethod/when_resolving/with_a_long_url.ts +17 -0
- package/queries/for_lengthBasedQueryHttpMethod/when_resolving/with_a_long_url_and_a_custom_method.ts +17 -0
- package/queries/for_lengthBasedQueryHttpMethod/when_resolving/with_a_short_url.ts +16 -0
- package/queries/index.ts +3 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { buildQueryHttpRequest } from '../../QueryHttpRequest';
|
|
2
|
+
import { QueryHttpMethod } from '../../QueryHttpMethod';
|
|
3
|
+
import { Paging } from '../../Paging';
|
|
4
|
+
import { Sorting } from '../../Sorting';
|
|
5
|
+
describe('when building with get method', () => {
|
|
6
|
+
let result;
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
result = buildQueryHttpRequest(QueryHttpMethod.Get, {
|
|
9
|
+
route: '/api/test/{id}',
|
|
10
|
+
apiBasePath: '/api/v1',
|
|
11
|
+
origin: 'https://api.example.com',
|
|
12
|
+
args: { id: 'abc', filter: 'active' },
|
|
13
|
+
parameterValues: {},
|
|
14
|
+
paging: Paging.noPaging,
|
|
15
|
+
sorting: Sorting.none,
|
|
16
|
+
headers: { 'Accept': 'application/json' }
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
it('should use the GET method', () => result.init.method.should.equal('GET'));
|
|
20
|
+
it('should substitute route parameters and append remaining arguments to the query string', () => result.url.href.should.equal('https://api.example.com/api/v1/api/test/abc?filter=active'));
|
|
21
|
+
it('should not have a body', () => (result.init.body === undefined).should.be.true);
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=with_get_method.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_get_method.js","sourceRoot":"","sources":["../../../../../queries/for_buildQueryHttpRequest/when_building/with_get_method.ts"],"names":[],"mappings":"AAGA,OAAO,EAA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ildQueryHttpRequest/when_building/with_query_method.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { buildQueryHttpRequest } from '../../QueryHttpRequest';
|
|
2
|
+
import { QueryHttpMethod } from '../../QueryHttpMethod';
|
|
3
|
+
import { Paging } from '../../Paging';
|
|
4
|
+
import { Sorting } from '../../Sorting';
|
|
5
|
+
describe('when building with query method', () => {
|
|
6
|
+
let result;
|
|
7
|
+
let body;
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
result = buildQueryHttpRequest(QueryHttpMethod.Query, {
|
|
10
|
+
route: '/api/test/{id}',
|
|
11
|
+
apiBasePath: '/api/v1',
|
|
12
|
+
origin: 'https://api.example.com',
|
|
13
|
+
args: { id: 'abc', filter: 'active' },
|
|
14
|
+
parameterValues: {},
|
|
15
|
+
paging: Paging.noPaging,
|
|
16
|
+
sorting: Sorting.none,
|
|
17
|
+
headers: { 'Accept': 'application/json' }
|
|
18
|
+
});
|
|
19
|
+
body = JSON.parse(result.init.body);
|
|
20
|
+
});
|
|
21
|
+
it('should use the QUERY method', () => result.init.method.should.equal('QUERY'));
|
|
22
|
+
it('should substitute route parameters in the path', () => result.url.href.should.equal('https://api.example.com/api/v1/api/test/abc'));
|
|
23
|
+
it('should not put arguments in the query string', () => result.url.search.should.equal(''));
|
|
24
|
+
it('should carry non-route arguments in the body', () => body.arguments.filter.should.equal('active'));
|
|
25
|
+
it('should not carry route arguments in the body', () => (body.arguments.id === undefined).should.be.true);
|
|
26
|
+
it('should set the content type to json', () => new Headers(result.init.headers).get('Content-Type').should.equal('application/json'));
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=with_query_method.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_query_method.js","sourceRoot":"","sources":["../../../../../queries/for_buildQueryHttpRequest/when_building/with_query_method.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D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AAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEvG,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IAE3G,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE,CAC3C,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,cAAc,CAAE,CAAC,MAAM,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC;AAChG,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_query_method_and_paging_and_sorting.d.ts","sourceRoot":"","sources":["../../../../../queries/for_buildQueryHttpRequest/when_building/with_query_method_and_paging_and_sorting.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { buildQueryHttpRequest } from '../../QueryHttpRequest';
|
|
2
|
+
import { QueryHttpMethod } from '../../QueryHttpMethod';
|
|
3
|
+
import { Paging } from '../../Paging';
|
|
4
|
+
import { Sorting } from '../../Sorting';
|
|
5
|
+
import { SortDirection } from '../../SortDirection';
|
|
6
|
+
describe('when building with query method and paging and sorting', () => {
|
|
7
|
+
let result;
|
|
8
|
+
let body;
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
result = buildQueryHttpRequest(QueryHttpMethod.Query, {
|
|
11
|
+
route: '/api/all',
|
|
12
|
+
apiBasePath: '',
|
|
13
|
+
origin: 'https://api.example.com',
|
|
14
|
+
args: {},
|
|
15
|
+
parameterValues: {},
|
|
16
|
+
paging: new Paging(2, 25),
|
|
17
|
+
sorting: new Sorting('name', SortDirection.descending),
|
|
18
|
+
headers: {}
|
|
19
|
+
});
|
|
20
|
+
body = JSON.parse(result.init.body);
|
|
21
|
+
});
|
|
22
|
+
it('should carry paging in the body', () => body.paging.should.deep.equal({ page: 2, pageSize: 25 }));
|
|
23
|
+
it('should carry sorting in the body', () => body.sorting.should.deep.equal({ field: 'name', direction: 'desc' }));
|
|
24
|
+
it('should not put paging or sorting in the query string', () => result.url.search.should.equal(''));
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=with_query_method_and_paging_and_sorting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_query_method_and_paging_and_sorting.js","sourceRoot":"","sources":["../../../../../queries/for_buildQueryHttpRequest/when_building/with_query_method_and_paging_and_sorting.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,QAAQ,CAAC,wDAAwD,EAAE,GAAG,EAAE;IACpE,IAAI,MAAuC,CAAC;IAE5C,IAAI,IAAS,CAAC;IAGd,UAAU,CAAC,GAAG,EAAE;QACZ,MAAM,GAAG,qBAAqB,CAAC,eAAe,CAAC,KAAK,EAAE;YAClD,KAAK,EAAE,UAAU;YACjB,WAAW,EAAE,EAAE;YACf,MAAM,EAAE,yBAAyB;YACjC,IAAI,EAAE,EAAE;YACR,eAAe,EAAE,EAAE;YACnB,MAAM,EAAE,IAAI,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC;YACzB,OAAO,EAAE,IAAI,OAAO,CAAC,MAAM,EAAE,aAAa,CAAC,UAAU,CAAC;YACtD,OAAO,EAAE,EAAE;SACd,CAAC,CAAC;QACH,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAc,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iCAAiC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IAEtG,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;IAEnH,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;AACzG,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../../queries/for_executeQueryHttpRequest/options.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAMnE,wBAAgB,WAAW,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,4BAA4B,CAAC,GAAG,4BAA4B,CAY3G"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Paging } from '../Paging';
|
|
2
|
+
import { Sorting } from '../Sorting';
|
|
3
|
+
export function makeOptions(overrides) {
|
|
4
|
+
return {
|
|
5
|
+
route: '/api/test',
|
|
6
|
+
apiBasePath: '',
|
|
7
|
+
origin: 'https://api.example.com',
|
|
8
|
+
args: {},
|
|
9
|
+
parameterValues: {},
|
|
10
|
+
paging: Paging.noPaging,
|
|
11
|
+
sorting: Sorting.none,
|
|
12
|
+
headers: {},
|
|
13
|
+
...overrides
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../../../queries/for_executeQueryHttpRequest/options.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAOrC,MAAM,UAAU,WAAW,CAAC,SAAiD;IACzE,OAAO;QACH,KAAK,EAAE,WAAW;QAClB,WAAW,EAAE,EAAE;QACf,MAAM,EAAE,yBAAyB;QACjC,IAAI,EAAE,EAAE;QACR,eAAe,EAAE,EAAE;QACnB,MAAM,EAAE,MAAM,CAAC,QAAQ;QACvB,OAAO,EAAE,OAAO,CAAC,IAAI;QACrB,OAAO,EAAE,EAAE;QACX,GAAG,SAAS;KACf,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_a_resolver.d.ts","sourceRoot":"","sources":["../../../../../queries/for_executeQueryHttpRequest/when_performing/with_a_resolver.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createFetchHelper } from '../../../helpers/fetchHelper';
|
|
2
|
+
import { executeQueryHttpRequest, resetQueryHttpMethodResolution } from '../../QueryHttpRequest';
|
|
3
|
+
import { QueryHttpMethod } from '../../QueryHttpMethod';
|
|
4
|
+
import { Globals } from '../../../Globals';
|
|
5
|
+
import { makeOptions } from '../options';
|
|
6
|
+
describe('when performing with a resolver', () => {
|
|
7
|
+
let fetchStub;
|
|
8
|
+
let fetchHelper;
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
resetQueryHttpMethodResolution();
|
|
11
|
+
fetchHelper = createFetchHelper();
|
|
12
|
+
fetchStub = fetchHelper.stubFetch();
|
|
13
|
+
fetchStub.resolves({ status: 200 });
|
|
14
|
+
Globals.queryHttpMethodResolver = () => QueryHttpMethod.Query;
|
|
15
|
+
await executeQueryHttpRequest(undefined, makeOptions());
|
|
16
|
+
});
|
|
17
|
+
afterEach(() => {
|
|
18
|
+
Globals.queryHttpMethodResolver = undefined;
|
|
19
|
+
fetchHelper.restore();
|
|
20
|
+
});
|
|
21
|
+
it('should use the method chosen by the resolver', () => fetchStub.getCall(0).args[1].method.should.equal('QUERY'));
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=with_a_resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_a_resolver.js","sourceRoot":"","sources":["../../../../../queries/for_executeQueryHttpRequest/when_performing/with_a_resolver.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AACjG,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,QAAQ,CAAC,iCAAiC,EAAE,GAAG,EAAE;IAC7C,IAAI,SAA0B,CAAC;IAC/B,IAAI,WAAsE,CAAC;IAE3E,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,8BAA8B,EAAE,CAAC;QACjC,WAAW,GAAG,iBAAiB,EAAE,CAAC;QAClC,SAAS,GAAG,WAAW,CAAC,SAAS,EAAE,CAAC;QACpC,SAAS,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,EAAyB,CAAC,CAAC;QAC3D,OAAO,CAAC,uBAAuB,GAAG,GAAG,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC;QAE9D,MAAM,uBAAuB,CAAC,SAAS,EAAE,WAAW,EAAE,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACX,OAAO,CAAC,uBAAuB,GAAG,SAAS,CAAC;QAC5C,WAAW,CAAC,OAAO,EAAE,CAAC;IAC1B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;AACxH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_a_resolver_and_an_explicit_override.d.ts","sourceRoot":"","sources":["../../../../../queries/for_executeQueryHttpRequest/when_performing/with_a_resolver_and_an_explicit_override.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createFetchHelper } from '../../../helpers/fetchHelper';
|
|
2
|
+
import { executeQueryHttpRequest, resetQueryHttpMethodResolution } from '../../QueryHttpRequest';
|
|
3
|
+
import { QueryHttpMethod } from '../../QueryHttpMethod';
|
|
4
|
+
import { Globals } from '../../../Globals';
|
|
5
|
+
import { makeOptions } from '../options';
|
|
6
|
+
describe('when performing with a resolver and an explicit override', () => {
|
|
7
|
+
let fetchStub;
|
|
8
|
+
let fetchHelper;
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
resetQueryHttpMethodResolution();
|
|
11
|
+
fetchHelper = createFetchHelper();
|
|
12
|
+
fetchStub = fetchHelper.stubFetch();
|
|
13
|
+
fetchStub.resolves({ status: 200 });
|
|
14
|
+
Globals.queryHttpMethodResolver = () => QueryHttpMethod.Query;
|
|
15
|
+
await executeQueryHttpRequest(QueryHttpMethod.Get, makeOptions());
|
|
16
|
+
});
|
|
17
|
+
afterEach(() => {
|
|
18
|
+
Globals.queryHttpMethodResolver = undefined;
|
|
19
|
+
fetchHelper.restore();
|
|
20
|
+
});
|
|
21
|
+
it('should honor the explicit override over the resolver', () => fetchStub.getCall(0).args[1].method.should.equal('GET'));
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=with_a_resolver_and_an_explicit_override.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_a_resolver_and_an_explicit_override.js","sourceRoot":"","sources":["../../../../../queries/for_executeQueryHttpRequest/when_performing/with_a_resolver_and_an_explicit_override.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AACjG,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,QAAQ,CAAC,0DAA0D,EAAE,GAAG,EAAE;IACtE,IAAI,SAA0B,CAAC;IAC/B,IAAI,WAAsE,CAAC;IAE3E,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,8BAA8B,EAAE,CAAC;QACjC,WAAW,GAAG,iBAAiB,EAAE,CAAC;QAClC,SAAS,GAAG,WAAW,CAAC,SAAS,EAAE,CAAC;QACpC,SAAS,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,EAAyB,CAAC,CAAC;QAC3D,OAAO,CAAC,uBAAuB,GAAG,GAAG,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC;QAE9D,MAAM,uBAAuB,CAAC,eAAe,CAAC,GAAG,EAAE,WAAW,EAAE,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACX,OAAO,CAAC,uBAAuB,GAAG,SAAS,CAAC;QAC5C,WAAW,CAAC,OAAO,EAAE,CAAC;IAC1B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AAC9H,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_auto_after_query_was_found_unsupported.d.ts","sourceRoot":"","sources":["../../../../../queries/for_executeQueryHttpRequest/when_performing/with_auto_after_query_was_found_unsupported.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createFetchHelper } from '../../../helpers/fetchHelper';
|
|
2
|
+
import { executeQueryHttpRequest, resetQueryHttpMethodResolution } from '../../QueryHttpRequest';
|
|
3
|
+
import { QueryHttpMethod } from '../../QueryHttpMethod';
|
|
4
|
+
import { makeOptions } from '../options';
|
|
5
|
+
describe('when performing with auto after query was found unsupported', () => {
|
|
6
|
+
let fetchStub;
|
|
7
|
+
let fetchHelper;
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
resetQueryHttpMethodResolution();
|
|
10
|
+
fetchHelper = createFetchHelper();
|
|
11
|
+
fetchStub = fetchHelper.stubFetch();
|
|
12
|
+
fetchStub.callsFake((_url, init) => Promise.resolve({ status: init.method === 'QUERY' ? 405 : 200 }));
|
|
13
|
+
await executeQueryHttpRequest(QueryHttpMethod.Auto, makeOptions());
|
|
14
|
+
await executeQueryHttpRequest(QueryHttpMethod.Auto, makeOptions());
|
|
15
|
+
});
|
|
16
|
+
afterEach(() => fetchHelper.restore());
|
|
17
|
+
it('should only attempt QUERY once across both queries', () => fetchStub.getCalls().filter(call => call.args[1].method === 'QUERY').length.should.equal(1));
|
|
18
|
+
it('should send the second query directly as GET', () => fetchStub.getCall(2).args[1].method.should.equal('GET'));
|
|
19
|
+
it('should send three requests in total', () => fetchStub.callCount.should.equal(3));
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=with_auto_after_query_was_found_unsupported.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_auto_after_query_was_found_unsupported.js","sourceRoot":"","sources":["../../../../../queries/for_executeQueryHttpRequest/when_performing/with_auto_after_query_was_found_unsupported.ts"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E,GAAG,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IAClH,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACzF,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_auto_and_a_network_failure.d.ts","sourceRoot":"","sources":["../../../../../queries/for_executeQueryHttpRequest/when_performing/with_auto_and_a_network_failure.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createFetchHelper } from '../../../helpers/fetchHelper';
|
|
2
|
+
import { executeQueryHttpRequest, resetQueryHttpMethodResolution } from '../../QueryHttpRequest';
|
|
3
|
+
import { QueryHttpMethod } from '../../QueryHttpMethod';
|
|
4
|
+
import { makeOptions } from '../options';
|
|
5
|
+
describe('when performing with auto and a network failure', () => {
|
|
6
|
+
let fetchStub;
|
|
7
|
+
let fetchHelper;
|
|
8
|
+
let result;
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
resetQueryHttpMethodResolution();
|
|
11
|
+
fetchHelper = createFetchHelper();
|
|
12
|
+
fetchStub = fetchHelper.stubFetch();
|
|
13
|
+
fetchStub.callsFake((_url, init) => init.method === 'QUERY'
|
|
14
|
+
? Promise.reject(new TypeError('Failed to fetch'))
|
|
15
|
+
: Promise.resolve({ status: 200 }));
|
|
16
|
+
result = await executeQueryHttpRequest(QueryHttpMethod.Auto, makeOptions());
|
|
17
|
+
});
|
|
18
|
+
afterEach(() => fetchHelper.restore());
|
|
19
|
+
it('should attempt QUERY first', () => fetchStub.getCall(0).args[1].method.should.equal('QUERY'));
|
|
20
|
+
it('should fall back to GET on the thrown error', () => fetchStub.getCall(1).args[1].method.should.equal('GET'));
|
|
21
|
+
it('should return the GET response', () => result.status.should.equal(200));
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=with_auto_and_a_network_failure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_auto_and_a_network_failure.js","sourceRoot":"","sources":["../../../../../queries/for_executeQueryHttpRequest/when_performing/with_auto_and_a_network_failure.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AACjG,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,QAAQ,CAAC,iDAAiD,EAAE,GAAG,EAAE;IAC7D,IAAI,SAA0B,CAAC;IAC/B,IAAI,WAAsE,CAAC;IAC3E,IAAI,MAAgB,CAAC;IAErB,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,8BAA8B,EAAE,CAAC;QACjC,WAAW,GAAG,iBAAiB,EAAE,CAAC;QAClC,SAAS,GAAG,WAAW,CAAC,SAAS,EAAE,CAAC;QACpC,SAAS,CAAC,SAAS,CAAC,CAAC,IAAS,EAAE,IAAiB,EAAE,EAAE,CACjD,IAAI,CAAC,MAAM,KAAK,OAAO;YACnB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC,iBAAiB,CAAC,CAAC;YAClD,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,EAAyB,CAAC,CAAC,CAAC;QACnE,MAAM,GAAG,MAAM,uBAAuB,CAAC,eAAe,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;IAChF,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,CAAC;IAEvC,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAClG,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IACjH,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAChF,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_auto_and_an_aborted_request.d.ts","sourceRoot":"","sources":["../../../../../queries/for_executeQueryHttpRequest/when_performing/with_auto_and_an_aborted_request.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createFetchHelper } from '../../../helpers/fetchHelper';
|
|
2
|
+
import { executeQueryHttpRequest, resetQueryHttpMethodResolution } from '../../QueryHttpRequest';
|
|
3
|
+
import { QueryHttpMethod } from '../../QueryHttpMethod';
|
|
4
|
+
import { makeOptions } from '../options';
|
|
5
|
+
describe('when performing with auto and an aborted request', () => {
|
|
6
|
+
let fetchStub;
|
|
7
|
+
let fetchHelper;
|
|
8
|
+
let error;
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
resetQueryHttpMethodResolution();
|
|
11
|
+
fetchHelper = createFetchHelper();
|
|
12
|
+
fetchStub = fetchHelper.stubFetch();
|
|
13
|
+
fetchStub.callsFake(() => Promise.reject(Object.assign(new Error('aborted'), { name: 'AbortError' })));
|
|
14
|
+
try {
|
|
15
|
+
await executeQueryHttpRequest(QueryHttpMethod.Auto, makeOptions());
|
|
16
|
+
}
|
|
17
|
+
catch (caught) {
|
|
18
|
+
error = caught;
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
afterEach(() => fetchHelper.restore());
|
|
22
|
+
it('should rethrow the abort error', () => error.name.should.equal('AbortError'));
|
|
23
|
+
it('should not fall back to GET', () => fetchStub.callCount.should.equal(1));
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=with_auto_and_an_aborted_request.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_auto_and_an_aborted_request.js","sourceRoot":"","sources":["../../../../../queries/for_executeQueryHttpRequest/when_performing/with_auto_and_an_aborted_request.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AACjG,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,QAAQ,CAAC,kDAAkD,EAAE,GAAG,EAAE;IAC9D,IAAI,SAA0B,CAAC;IAC/B,IAAI,WAAsE,CAAC;IAC3E,IAAI,KAAoC,CAAC;IAEzC,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,8BAA8B,EAAE,CAAC;QACjC,WAAW,GAAG,iBAAiB,EAAE,CAAC;QAClC,SAAS,GAAG,WAAW,CAAC,SAAS,EAAE,CAAC;QACpC,SAAS,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC;QACvG,IAAI,CAAC;YACD,MAAM,uBAAuB,CAAC,eAAe,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;QACvE,CAAC;QAAC,OAAO,MAAM,EAAE,CAAC;YACd,KAAK,GAAG,MAA2B,CAAC;QACxC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,CAAC;IAEvC,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE,CAAC,KAAM,CAAC,IAAK,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;IACpF,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACjF,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_auto_and_an_application_error.d.ts","sourceRoot":"","sources":["../../../../../queries/for_executeQueryHttpRequest/when_performing/with_auto_and_an_application_error.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createFetchHelper } from '../../../helpers/fetchHelper';
|
|
2
|
+
import { executeQueryHttpRequest, resetQueryHttpMethodResolution } from '../../QueryHttpRequest';
|
|
3
|
+
import { QueryHttpMethod } from '../../QueryHttpMethod';
|
|
4
|
+
import { makeOptions } from '../options';
|
|
5
|
+
describe('when performing with auto and an application error', () => {
|
|
6
|
+
let fetchStub;
|
|
7
|
+
let fetchHelper;
|
|
8
|
+
let result;
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
resetQueryHttpMethodResolution();
|
|
11
|
+
fetchHelper = createFetchHelper();
|
|
12
|
+
fetchStub = fetchHelper.stubFetch();
|
|
13
|
+
fetchStub.resolves({ status: 400 });
|
|
14
|
+
result = await executeQueryHttpRequest(QueryHttpMethod.Auto, makeOptions());
|
|
15
|
+
});
|
|
16
|
+
afterEach(() => fetchHelper.restore());
|
|
17
|
+
it('should send a single request', () => fetchStub.callCount.should.equal(1));
|
|
18
|
+
it('should keep using QUERY', () => fetchStub.getCall(0).args[1].method.should.equal('QUERY'));
|
|
19
|
+
it('should return the QUERY response', () => result.status.should.equal(400));
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=with_auto_and_an_application_error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_auto_and_an_application_error.js","sourceRoot":"","sources":["../../../../../queries/for_executeQueryHttpRequest/when_performing/with_auto_and_an_application_error.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AACjG,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,QAAQ,CAAC,oDAAoD,EAAE,GAAG,EAAE;IAChE,IAAI,SAA0B,CAAC;IAC/B,IAAI,WAAsE,CAAC;IAC3E,IAAI,MAAgB,CAAC;IAErB,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,8BAA8B,EAAE,CAAC;QACjC,WAAW,GAAG,iBAAiB,EAAE,CAAC;QAClC,SAAS,GAAG,WAAW,CAAC,SAAS,EAAE,CAAC;QAEpC,SAAS,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,EAAyB,CAAC,CAAC;QAC3D,MAAM,GAAG,MAAM,uBAAuB,CAAC,eAAe,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;IAChF,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,CAAC;IAEvC,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9E,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAC/F,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAClF,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_auto_and_multiple_backends.d.ts","sourceRoot":"","sources":["../../../../../queries/for_executeQueryHttpRequest/when_performing/with_auto_and_multiple_backends.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createFetchHelper } from '../../../helpers/fetchHelper';
|
|
2
|
+
import { executeQueryHttpRequest, resetQueryHttpMethodResolution } from '../../QueryHttpRequest';
|
|
3
|
+
import { QueryHttpMethod } from '../../QueryHttpMethod';
|
|
4
|
+
import { makeOptions } from '../options';
|
|
5
|
+
describe('when performing with auto and multiple backends', () => {
|
|
6
|
+
let fetchStub;
|
|
7
|
+
let fetchHelper;
|
|
8
|
+
const unsupportedOrigin = 'https://legacy.example.com';
|
|
9
|
+
const supportedOrigin = 'https://modern.example.com';
|
|
10
|
+
beforeEach(async () => {
|
|
11
|
+
resetQueryHttpMethodResolution();
|
|
12
|
+
fetchHelper = createFetchHelper();
|
|
13
|
+
fetchStub = fetchHelper.stubFetch();
|
|
14
|
+
fetchStub.callsFake((url, init) => {
|
|
15
|
+
const rejectsQuery = url.origin === unsupportedOrigin && init.method === 'QUERY';
|
|
16
|
+
return Promise.resolve({ status: rejectsQuery ? 405 : 200 });
|
|
17
|
+
});
|
|
18
|
+
await executeQueryHttpRequest(QueryHttpMethod.Auto, makeOptions({ origin: unsupportedOrigin }));
|
|
19
|
+
await executeQueryHttpRequest(QueryHttpMethod.Auto, makeOptions({ origin: supportedOrigin }));
|
|
20
|
+
});
|
|
21
|
+
afterEach(() => fetchHelper.restore());
|
|
22
|
+
it('should use QUERY for the backend that supports it', () => {
|
|
23
|
+
const modernCalls = fetchStub.getCalls().filter(call => call.args[0].origin === supportedOrigin);
|
|
24
|
+
modernCalls.some(call => call.args[1].method === 'QUERY').should.be.true;
|
|
25
|
+
});
|
|
26
|
+
it('should not downgrade the supported backend to GET', () => {
|
|
27
|
+
const modernCalls = fetchStub.getCalls().filter(call => call.args[0].origin === supportedOrigin);
|
|
28
|
+
modernCalls.every(call => call.args[1].method === 'QUERY').should.be.true;
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=with_auto_and_multiple_backends.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_auto_and_multiple_backends.js","sourceRoot":"","sources":["../../../../../queries/for_executeQueryHttpRequest/when_performing/with_auto_and_multiple_backends.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AACjG,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,QAAQ,CAAC,iDAAiD,EAAE,GAAG,EAAE;IAC7D,IAAI,SAA0B,CAAC;IAC/B,IAAI,WAAsE,CAAC;IAC3E,MAAM,iBAAiB,GAAG,4BAA4B,CAAC;IACvD,MAAM,eAAe,GAAG,4BAA4B,CAAC;IAErD,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,8BAA8B,EAAE,CAAC;QACjC,WAAW,GAAG,iBAAiB,EAAE,CAAC;QAClC,SAAS,GAAG,WAAW,CAAC,SAAS,EAAE,CAAC;QAEpC,SAAS,CAAC,SAAS,CAAC,CAAC,GAAQ,EAAE,IAAiB,EAAE,EAAE;YAChD,MAAM,YAAY,GAAG,GAAG,CAAC,MAAM,KAAK,iBAAiB,IAAI,IAAI,C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AC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC;IAC9E,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_auto_and_query_supported.d.ts","sourceRoot":"","sources":["../../../../../queries/for_executeQueryHttpRequest/when_performing/with_auto_and_query_supported.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createFetchHelper } from '../../../helpers/fetchHelper';
|
|
2
|
+
import { executeQueryHttpRequest, resetQueryHttpMethodResolution } from '../../QueryHttpRequest';
|
|
3
|
+
import { QueryHttpMethod } from '../../QueryHttpMethod';
|
|
4
|
+
import { makeOptions } from '../options';
|
|
5
|
+
describe('when performing with auto and query supported', () => {
|
|
6
|
+
let fetchStub;
|
|
7
|
+
let fetchHelper;
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
resetQueryHttpMethodResolution();
|
|
10
|
+
fetchHelper = createFetchHelper();
|
|
11
|
+
fetchStub = fetchHelper.stubFetch();
|
|
12
|
+
fetchStub.resolves({ status: 200 });
|
|
13
|
+
await executeQueryHttpRequest(QueryHttpMethod.Auto, makeOptions());
|
|
14
|
+
});
|
|
15
|
+
afterEach(() => fetchHelper.restore());
|
|
16
|
+
it('should send a single request', () => fetchStub.callCount.should.equal(1));
|
|
17
|
+
it('should use the QUERY method', () => fetchStub.getCall(0).args[1].method.should.equal('QUERY'));
|
|
18
|
+
});
|
|
19
|
+
//# sourceMappingURL=with_auto_and_query_supported.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_auto_and_query_supported.js","sourceRoot":"","sources":["../../../../../queries/for_executeQueryHttpRequest/when_performing/with_auto_and_query_supported.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AACjG,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,QAAQ,CAAC,+CAA+C,EAAE,GAAG,EAAE;IAC3D,IAAI,SAA0B,CAAC;IAC/B,IAAI,WAAsE,CAAC;IAE3E,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,8BAA8B,EAAE,CAAC;QACjC,WAAW,GAAG,iBAAiB,EAAE,CAAC;QAClC,SAAS,GAAG,WAAW,CAAC,SAAS,EAAE,CAAC;QACpC,SAAS,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,EAAyB,CAAC,CAAC;QAC3D,MAAM,uBAAuB,CAAC,eAAe,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,CAAC;IAEvC,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9E,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;AACvG,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_auto_and_query_unsupported.d.ts","sourceRoot":"","sources":["../../../../../queries/for_executeQueryHttpRequest/when_performing/with_auto_and_query_unsupported.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createFetchHelper } from '../../../helpers/fetchHelper';
|
|
2
|
+
import { executeQueryHttpRequest, resetQueryHttpMethodResolution } from '../../QueryHttpRequest';
|
|
3
|
+
import { QueryHttpMethod } from '../../QueryHttpMethod';
|
|
4
|
+
import { makeOptions } from '../options';
|
|
5
|
+
describe('when performing with auto and query unsupported', () => {
|
|
6
|
+
let fetchStub;
|
|
7
|
+
let fetchHelper;
|
|
8
|
+
let result;
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
resetQueryHttpMethodResolution();
|
|
11
|
+
fetchHelper = createFetchHelper();
|
|
12
|
+
fetchStub = fetchHelper.stubFetch();
|
|
13
|
+
fetchStub.callsFake((_url, init) => Promise.resolve({ status: init.method === 'QUERY' ? 405 : 200 }));
|
|
14
|
+
result = await executeQueryHttpRequest(QueryHttpMethod.Auto, makeOptions());
|
|
15
|
+
});
|
|
16
|
+
afterEach(() => fetchHelper.restore());
|
|
17
|
+
it('should attempt QUERY first', () => fetchStub.getCall(0).args[1].method.should.equal('QUERY'));
|
|
18
|
+
it('should fall back to GET', () => fetchStub.getCall(1).args[1].method.should.equal('GET'));
|
|
19
|
+
it('should send exactly two requests', () => fetchStub.callCount.should.equal(2));
|
|
20
|
+
it('should return the GET response', () => result.status.should.equal(200));
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=with_auto_and_query_unsupported.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_auto_and_query_unsupported.js","sourceRoot":"","sources":["../../../../../queries/for_executeQueryHttpRequest/when_performing/with_auto_and_query_unsupported.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AACjG,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,QAAQ,CAAC,iDAAiD,EAAE,GAAG,EAAE;IAC7D,IAAI,SAA0B,CAAC;IAC/B,IAAI,WAAsE,CAAC;IAC3E,IAAI,MAAgB,CAAC;IAErB,UA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with_get_method.d.ts","sourceRoot":"","sources":["../../../../../queries/for_executeQueryHttpRequest/when_performing/with_get_method.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createFetchHelper } from '../../../helpers/fetchHelper';
|
|
2
|
+
import { executeQueryHttpRequest, resetQueryHttpMethodResolution } from '../../QueryHttpRequest';
|
|
3
|
+
import { QueryHttpMethod } from '../../QueryHttpMethod';
|
|
4
|
+
import { makeOptions } from '../options';
|
|
5
|
+
describe('when performing with get method', () => {
|
|
6
|
+
let fetchStub;
|
|
7
|
+
let fetchHelper;
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
resetQueryHttpMethodResolution();
|
|
10
|
+
fetchHelper = createFetchHelper();
|
|
11
|
+
fetchStub = fetchHelper.stubFetch();
|
|
12
|
+
fetchStub.resolves({ status: 200 });
|
|
13
|
+
await executeQueryHttpRequest(QueryHttpMethod.Get, makeOptions());
|
|
14
|
+
});
|
|
15
|
+
afterEach(() => fetchHelper.restore());
|
|
16
|
+
it('should send a single request', () => fetchStub.callCount.should.equal(1));
|
|
17
|
+
it('should use the GET method', () => fetchStub.getCall(0).args[1].method.should.equal('GET'));
|
|
18
|
+
});
|
|
19
|
+
//# sourceMappingURL=with_get_method.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_get_method.js","sourceRoot":"","sources":["../../../../../queries/for_executeQueryHttpRequest/when_performing/with_get_method.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AACjG,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,QAAQ,CAAC,iCAAiC,EAAE,GAAG,EAAE;IAC7C,IAAI,SAA0B,CAAC;IAC/B,IAAI,WAAsE,CAAC;IAE3E,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,8BAA8B,EAAE,CAAC;QACjC,WAAW,GAAG,iBAAiB,EAAE,CAAC;QAClC,SAAS,GAAG,WAAW,CAAC,SAAS,EAAE,CAAC;QACpC,SAAS,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,EAAyB,CAAC,CAAC;QAC3D,MAAM,uBAAuB,CAAC,eAAe,CAAC,GAAG,EAAE,WAAW,EAAE,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,CAAC;IAEvC,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9E,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AACnG,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_query_method_and_server_rejecting_the_verb.d.ts","sourceRoot":"","sources":["../../../../../queries/for_executeQueryHttpRequest/when_performing/with_query_method_and_server_rejecting_the_verb.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createFetchHelper } from '../../../helpers/fetchHelper';
|
|
2
|
+
import { executeQueryHttpRequest, resetQueryHttpMethodResolution } from '../../QueryHttpRequest';
|
|
3
|
+
import { QueryHttpMethod } from '../../QueryHttpMethod';
|
|
4
|
+
import { makeOptions } from '../options';
|
|
5
|
+
describe('when performing with query method and server rejecting the verb', () => {
|
|
6
|
+
let fetchStub;
|
|
7
|
+
let fetchHelper;
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
resetQueryHttpMethodResolution();
|
|
10
|
+
fetchHelper = createFetchHelper();
|
|
11
|
+
fetchStub = fetchHelper.stubFetch();
|
|
12
|
+
fetchStub.resolves({ status: 405 });
|
|
13
|
+
await executeQueryHttpRequest(QueryHttpMethod.Query, makeOptions());
|
|
14
|
+
});
|
|
15
|
+
afterEach(() => fetchHelper.restore());
|
|
16
|
+
it('should send a single request', () => fetchStub.callCount.should.equal(1));
|
|
17
|
+
it('should not fall back when the method was chosen explicitly', () => fetchStub.getCall(0).args[1].method.should.equal('QUERY'));
|
|
18
|
+
});
|
|
19
|
+
//# sourceMappingURL=with_query_method_and_server_rejecting_the_verb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_query_method_and_server_rejecting_the_verb.js","sourceRoot":"","sources":["../../../../../queries/for_executeQueryHttpRequest/when_performing/with_query_method_and_server_rejecting_the_verb.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AACjG,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,QAAQ,CAAC,iEAAiE,EAAE,GAAG,EAAE;IAC7E,IAAI,SAA0B,CAAC;IAC/B,IAAI,WAAsE,CAAC;IAE3E,UAAU,CAAC,KAAK,IAAI,EAAE;QAClB,8BAA8B,EAAE,CAAC;QACjC,WAAW,GAAG,iBAAiB,EAAE,CAAC;QAClC,SAAS,GAAG,WAAW,CAAC,SAAS,EAAE,CAAC;QACpC,SAAS,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,EAAyB,CAAC,CAAC;QAC3D,MAAM,uBAAuB,CAAC,eAAe,CAAC,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,CAAC;IAEvC,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9E,EAAE,CAAC,4DAA4D,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;AACtI,CAAC,CAAC,CAAC"}
|
package/dist/esm/queries/for_lengthBasedQueryHttpMethod/when_resolving/with_a_long_url.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_a_long_url.d.ts","sourceRoot":"","sources":["../../../../../queries/for_lengthBasedQueryHttpMethod/when_resolving/with_a_long_url.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { lengthBasedQueryHttpMethod } from '../../QueryHttpMethodResolver';
|
|
2
|
+
import { QueryHttpMethod } from '../../QueryHttpMethod';
|
|
3
|
+
describe('when resolving with a long url', () => {
|
|
4
|
+
let result;
|
|
5
|
+
beforeEach(() => {
|
|
6
|
+
const resolve = lengthBasedQueryHttpMethod({ threshold: 100 });
|
|
7
|
+
const longValue = 'x'.repeat(500);
|
|
8
|
+
result = resolve({ url: new URL(`https://api.example.com/api/test?search=${longValue}`), route: '/api/test', args: {} });
|
|
9
|
+
});
|
|
10
|
+
it('should prefer QUERY with fallback', () => result.should.equal(QueryHttpMethod.Auto));
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=with_a_long_url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_a_long_url.js","sourceRoot":"","sources":["../../../../../queries/for_lengthBasedQueryHttpMethod/when_resolving/with_a_long_url.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,QAAQ,CAAC,gCAAgC,EAAE,GAAG,EAAE;IAC5C,IAAI,MAAuB,CAAC;IAE5B,UAAU,CAAC,GAAG,EAAE;QACZ,MAAM,OAAO,GAAG,0BAA0B,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC;QAC/D,MAAM,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAClC,MAAM,GAAG,OAAO,CAAC,EAAE,GAAG,EAAE,IAAI,GAAG,CAAC,2CAA2C,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;IAC7H,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;AAC7F,CAAC,CAAC,CAAC"}
|