@webex/webex-core 3.12.0-next.61 → 3.12.0-next.63
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/.repo-context.json +653 -0
- package/.sdd/manifest.json +605 -0
- package/AGENTS.md +209 -0
- package/dist/lib/batcher.js +1 -1
- package/dist/lib/credentials/credentials.js +1 -1
- package/dist/lib/credentials/token.js +1 -1
- package/dist/lib/services/services.js +1 -1
- package/dist/lib/services-v2/services-v2.js +1 -1
- package/dist/plugins/logger.js +1 -1
- package/dist/webex-core.js +2 -2
- package/docs/adr/index.md +32 -0
- package/docs/architecture.md +298 -0
- package/docs/getting-started.md +96 -0
- package/docs/index.md +55 -0
- package/docs/specs/README.md +76 -0
- package/package.json +3 -3
- package/schemas/repo-context.schema.json +796 -0
- package/src/docs/README.md +732 -0
- package/src/interceptors/docs/README.md +658 -0
- package/src/lib/credentials/docs/README.md +846 -0
- package/src/lib/services/docs/README.md +737 -0
- package/src/lib/services-v2/docs/README.md +750 -0
- package/src/lib/storage/docs/README.md +646 -0
|
@@ -0,0 +1,658 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: Module Spec
|
|
3
|
+
title: 'interceptors specification'
|
|
4
|
+
description: Responsibilities, boundaries, design, invariants, and verification for the webex-core default HTTP interceptor set.
|
|
5
|
+
tags: [module, specification]
|
|
6
|
+
---
|
|
7
|
+
<!-- sdd-generated-metadata
|
|
8
|
+
doc_kind: module-spec
|
|
9
|
+
generated_from: module-spec@0.3.0
|
|
10
|
+
generated_by: claude-code
|
|
11
|
+
approved_by: rsarika@cisco.com
|
|
12
|
+
updated_at: 2026-10-07T13:20:21Z
|
|
13
|
+
validation_status: pass-with-warnings
|
|
14
|
+
-->
|
|
15
|
+
|
|
16
|
+
# interceptors
|
|
17
|
+
|
|
18
|
+
This source-local document at `src/interceptors/docs/README.md` owns the stable specification for the
|
|
19
|
+
**default interceptor set** of `@webex/webex-core`: sixteen `Interceptor` subclasses, one file each,
|
|
20
|
+
that add authentication, correlation, routing safety, redirect handling, timing, logging, event
|
|
21
|
+
emission, payload transformation, and failure side effects around every request the SDK makes.
|
|
22
|
+
|
|
23
|
+
The package export surface, the `WebexCore` constructor that instantiates and orders these classes,
|
|
24
|
+
and the configuration defaults they read belong to the parent module and are specified in
|
|
25
|
+
[`src/docs/README.md`](../../docs/README.md). The service-catalog interceptors in `src/lib/interceptors`
|
|
26
|
+
(`ServiceInterceptor`, `HostMapInterceptor`, `ServerErrorInterceptor`) belong to the services child
|
|
27
|
+
module and are referenced here only where ordering depends on them.
|
|
28
|
+
|
|
29
|
+
Related context: [repository architecture](../../../docs/architecture.md) ·
|
|
30
|
+
[documentation index](../../../docs/index.md) · [agent instructions](../../../AGENTS.md) ·
|
|
31
|
+
[specification registry](../../../docs/specs/README.md)
|
|
32
|
+
|
|
33
|
+
## Metadata
|
|
34
|
+
|
|
35
|
+
| Field | Value |
|
|
36
|
+
| ----------------- | ---------------------------------------------- |
|
|
37
|
+
| Owner | Cisco Webex for Developers |
|
|
38
|
+
| Source path | `src/interceptors` |
|
|
39
|
+
| Resource kind | Capability module |
|
|
40
|
+
| Status | Active |
|
|
41
|
+
| Last verified | 2026-10-07 |
|
|
42
|
+
| Module id | `src/interceptors` |
|
|
43
|
+
| Parent spec | [`src/docs/README.md`](../../docs/README.md) |
|
|
44
|
+
| Doc kind | Module spec |
|
|
45
|
+
| Coverage score | 93.8% assessed 2026-10-07; 15 of 16 mandatory fields present; critical 8 of 8; independent validation pass-with-warnings 2026-10-07 |
|
|
46
|
+
| Validation status | Pass with warnings — 2026-10-07; runtime `01a1166d-02d9-7772-bc25-1a801fb5f1d1`; 0 Blocking, 8 Important, 3 Medium |
|
|
47
|
+
|
|
48
|
+
## Applicability
|
|
49
|
+
|
|
50
|
+
| Condition ID | Status | Evidence or reason | Owned section |
|
|
51
|
+
| ------------------------------------ | ---------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------- |
|
|
52
|
+
| `module.has_tiers` | N/A | The repository assigns no operational or review tiers | Tier |
|
|
53
|
+
| `module.has_ui` | N/A | No components or rendering | UI use-case flow |
|
|
54
|
+
| `module.crosses_service_boundaries` | Applicable | `src/interceptors/auth.js` consults the service catalog and refreshes tokens; `src/interceptors/redirect.js` re-issues requests | Cross-boundary use-case flow |
|
|
55
|
+
| `module.holds_client_state` | Applicable | Rate-limit expiry maps, tracking-id sequence counters, and per-request $timings, $redirectCount, replayCount markers | Client state model |
|
|
56
|
+
| `module.enforces_domain_rules` | Applicable | `src/interceptors/catalog-url.js` host allow-listing, `src/interceptors/embargo.js` HTTP 451 handling, redirect and replay ceilings | Business rules and invariants |
|
|
57
|
+
| `module.is_concurrent_async` | Applicable | Promise-returning hooks, re-entrant webex.request calls, and a shared in-flight inbound transform in `src/interceptors/payload-transformer.js` | Concurrency and reactive flow |
|
|
58
|
+
| `module.owns_persistence` | N/A | All state is in-memory and per interceptor instance or per request | Data, schema, and migration |
|
|
59
|
+
| `module.stateful_transitions` | N/A | Counters on the options object are bounded retries, not a lifecycle with named states | State machine |
|
|
60
|
+
| `module.exposes_wire_protocol` | Applicable | Request and response header names and body error codes in `src/interceptors/redirect.js`, `src/interceptors/webex-tracking-id.js`, `src/interceptors/webex-user-agent.js` | Protocol and wire format |
|
|
61
|
+
| `module.ui_multi_screen` | N/A | Gated by module.has_ui, which is N/A | UI flow |
|
|
62
|
+
| `module.large_data_model` | N/A | Gated by module.owns_persistence, which is N/A | Data model |
|
|
63
|
+
| `module.returns_caller_errors` | Applicable | Rejections originate in `src/interceptors/catalog-url.js`, `src/interceptors/rate-limit.js`, `src/interceptors/redirect.js`, `src/interceptors/auth.js` | Caller-visible failure modes |
|
|
64
|
+
| `module.module_specific_conventions` | Applicable | Hooks must mirror the base-class return contract and be registered by name in `src/webex-core.js` | Module-specific rules |
|
|
65
|
+
| `module.published_package` | Applicable | All sixteen classes are re-exported from `src/index.js`; `package.json` declares the entry point | Export stability |
|
|
66
|
+
| `module.embedded_in_host` | N/A | Not mounted into a host application | Host integration and theming |
|
|
67
|
+
| `module.has_design_tradeoff` | Applicable | One shared pipeline and ordering mutate a single options object; replay and redirect re-enter the whole chain | Key design trade-off |
|
|
68
|
+
| `module.has_submodules` | N/A | No child modules; computed from the manifest module tree | Sub-modules |
|
|
69
|
+
|
|
70
|
+
## Evidence register
|
|
71
|
+
|
|
72
|
+
| Evidence | What it establishes |
|
|
73
|
+
| -------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
|
|
74
|
+
| `src/interceptors/auth.js` | Header injection, credential-requirement decision, 401 refresh and replay |
|
|
75
|
+
| `src/interceptors/catalog-url.js` | Catalog and allowed-domain URL validation |
|
|
76
|
+
| `src/interceptors/default-options.js` | Merge of configured default request options |
|
|
77
|
+
| `src/interceptors/embargo.js` | HTTP 451 credential and device clearing |
|
|
78
|
+
| `src/interceptors/network-timing.js` | `networkStart` and `networkEnd` timestamps |
|
|
79
|
+
| `src/interceptors/payload-transformer.js` | Outbound, inbound, and error payload transforms and the repeated-inbound guard |
|
|
80
|
+
| `src/interceptors/proxy.js` | Node-only proxy option |
|
|
81
|
+
| `src/interceptors/rate-limit.js` | Identity-API 429 bookkeeping and short-circuit |
|
|
82
|
+
| `src/interceptors/redirect.js` | No-redirect request header and the three redirect shapes |
|
|
83
|
+
| `src/interceptors/request-event.js` | `request:*` event emission |
|
|
84
|
+
| `src/interceptors/request-logger.js` | Request log lines and verbose option dump |
|
|
85
|
+
| `src/interceptors/request-timing.js` | `requestStart`, `requestEnd`, `requestFail` timestamps |
|
|
86
|
+
| `src/interceptors/response-logger.js` | Response log lines, durations, and verbose body dump |
|
|
87
|
+
| `src/interceptors/user-agent.js` | Node-only `user-agent` header |
|
|
88
|
+
| `src/interceptors/webex-tracking-id.js` | `trackingid` header generation and replay suffix |
|
|
89
|
+
| `src/interceptors/webex-user-agent.js` | `spark-user-agent` header composition |
|
|
90
|
+
| `src/webex-core.js` | The registry map, the pre and post lists, the assembly algorithm, and the opt-in rule for `CatalogUrlInterceptor` |
|
|
91
|
+
| `src/config.js` | Defaults for the redirect and replay ceilings, `payloadTransformer`, and `services.validateCatalogUrls` |
|
|
92
|
+
| `src/index.js` | Which interceptor classes are exported |
|
|
93
|
+
| `src/lib/webex-core-plugin-mixin.js` | How plugins add entries to the shared interceptor registry |
|
|
94
|
+
| `test/unit/spec/interceptors/auth.js` | Auth header, credential decision, refresh, replay, and opt-out cases |
|
|
95
|
+
| `test/unit/spec/interceptors/catalog-url.js` | Allow, block, bypass, and allowed-domains cases |
|
|
96
|
+
| `test/unit/spec/interceptors/rate-limit.js` | Rate-limit helpers; ten of its cases are skipped |
|
|
97
|
+
| `test/unit/spec/interceptors/redirect.js` | Locus and App API redirects, ceilings, and preJoin authorization removal |
|
|
98
|
+
| `test/unit/spec/interceptors/payload-transformer.js` | Outbound transform and the repeated-inbound guard |
|
|
99
|
+
| `test/unit/spec/webex-core.js` | Assembled interceptor order and counts (parent-owned) |
|
|
100
|
+
| `test/integration/spec/unit-browser/auth.js` | Refresh-and-replay against a live environment |
|
|
101
|
+
|
|
102
|
+
The `### Configuration surface` extension heading under Public surface is justified because the config keys
|
|
103
|
+
these classes read (`src/config.js`) are a published consumer contract with no slot in the module template;
|
|
104
|
+
keys whose behavior is parent-owned are pointed at the parent spec rather than restated.
|
|
105
|
+
|
|
106
|
+
The base contract these classes inherit is the `Interceptor` class of the http-core package, described
|
|
107
|
+
in its specification: four pass-through hooks (`onRequest`, `onRequestError`, `onResponse`,
|
|
108
|
+
`onResponseError`), a `logOptions` helper, and a `create()` that throws unless overridden. This
|
|
109
|
+
specification does not restate that contract; it records how each subclass here departs from or
|
|
110
|
+
relies on it.
|
|
111
|
+
|
|
112
|
+
## Purpose and boundary
|
|
113
|
+
|
|
114
|
+
- **Responsibility:** provide the behaviors every SDK HTTP request needs before it reaches the
|
|
115
|
+
transport and after it returns, each isolated in one class so the set can be reordered, replaced,
|
|
116
|
+
or extended through configuration.
|
|
117
|
+
- **In scope:** the sixteen classes, one file each under `src/interceptors` (see Structure and key files); the header names, option keys, and
|
|
118
|
+
config keys each reads or writes; the errors each raises; the retry and replay behavior of
|
|
119
|
+
`AuthInterceptor` and `RedirectInterceptor`; the per-request markers they leave on the options
|
|
120
|
+
object.
|
|
121
|
+
- **Out of scope:** instantiation and ordering (parent module); `ServiceInterceptor`,
|
|
122
|
+
`HostMapInterceptor`, and `ServerErrorInterceptor` (services child); the status-to-error
|
|
123
|
+
conversion, which is the http-core `HttpStatusInterceptor`; the credential and token behavior that
|
|
124
|
+
`AuthInterceptor` calls into (credentials child); the transport and the interceptor fold (http-core).
|
|
125
|
+
- **Consumers:** `WebexCore` builds the chain in `src/webex-core.js`, so every plugin request flows
|
|
126
|
+
through these classes. `internal-plugin-metrics` subscribes to the `request:start`,
|
|
127
|
+
`request:success`, and `request:failure` events this module emits. No other package in the
|
|
128
|
+
repository imports an interceptor class by name from this package.
|
|
129
|
+
|
|
130
|
+
## Structure and key files
|
|
131
|
+
|
|
132
|
+
| Path | Responsibility |
|
|
133
|
+
| ----------------------------------------- | ------------------------------------------------------------------------------------------------ |
|
|
134
|
+
| `src/interceptors/auth.js` | Adds the user token as `authorization`; on 401 refreshes credentials and replays the request |
|
|
135
|
+
| `src/interceptors/catalog-url.js` | Rejects request URLs that are neither in the service catalog nor in the allowed domains |
|
|
136
|
+
| `src/interceptors/default-options.js` | Fills missing request options from `config.defaultRequestOptions` |
|
|
137
|
+
| `src/interceptors/embargo.js` | On HTTP 451, clears credentials and the device registration, then re-rejects |
|
|
138
|
+
| `src/interceptors/network-timing.js` | Stamps `$timings.networkStart` and `$timings.networkEnd` |
|
|
139
|
+
| `src/interceptors/payload-transformer.js` | Runs the core `transform` pipeline on outbound options, inbound responses, and inbound errors |
|
|
140
|
+
| `src/interceptors/proxy.js` | Sets `options.proxy` from `config.proxy` outside the browser |
|
|
141
|
+
| `src/interceptors/rate-limit.js` | Rejects identity-API requests while a 429 `retry-after` window is open |
|
|
142
|
+
| `src/interceptors/redirect.js` | Opts out of server-side redirects and follows three application-level redirect forms |
|
|
143
|
+
| `src/interceptors/request-event.js` | Triggers `request:start`, `request:success`, `request:failure`, `request:end` on the webex object |
|
|
144
|
+
| `src/interceptors/request-logger.js` | Logs the outgoing request, and optionally the full options |
|
|
145
|
+
| `src/interceptors/request-timing.js` | Stamps `$timings.requestStart`, `requestEnd`, `requestFail` |
|
|
146
|
+
| `src/interceptors/response-logger.js` | Logs status, tracking id, and network and processing durations |
|
|
147
|
+
| `src/interceptors/user-agent.js` | Sets the `user-agent` header outside the browser |
|
|
148
|
+
| `src/interceptors/webex-tracking-id.js` | Sets the `trackingid` header as `<sessionId>_<sequence>`, with a replay suffix |
|
|
149
|
+
| `src/interceptors/webex-user-agent.js` | Sets the `spark-user-agent` header |
|
|
150
|
+
|
|
151
|
+
Every file exports exactly one default class with a static `create()` that is invoked with the
|
|
152
|
+
`WebexCore` instance as `this`. Only `src/interceptors/webex-tracking-id.js` has a second export
|
|
153
|
+
(`sequenceNumbers`). `src/index.js` re-exports all sixteen classes and the counter map (as `webexTrackingIdSequenceNumbers`).
|
|
154
|
+
|
|
155
|
+
## Public surface
|
|
156
|
+
|
|
157
|
+
| Surface | Contract | Consumer | Compatibility commitment | Source |
|
|
158
|
+
| --- | --- | --- | --- | --- |
|
|
159
|
+
| Interceptor classes (all 16) | `webex-core-interceptors` | Packages assembling a custom chain through `config.interceptors` | Class names are the registry keys and are therefore stable; behavior is not versioned separately | `src/index.js` |
|
|
160
|
+
| `create()` factories | `webex-core-interceptors` | `WebexCore` and plugins registering interceptors | Called with the webex instance as `this`; `NetworkTimingInterceptor` and `RequestTimingInterceptor` pass `this` as constructor attributes instead, see Pitfalls | `src/webex-core.js` |
|
|
161
|
+
| `request:start`, `request:success`, `request:failure`, `request:end` events | `webex-core-interceptors` | `internal-plugin-metrics` and any `webex.on` subscriber | Emitted on the webex instance with the options (and response or error) as arguments | `src/interceptors/request-event.js` |
|
|
162
|
+
| `trackingid`, `spark-user-agent`, `user-agent`, `authorization`, `cisco-no-http-redirect` request headers | `webex-core-interceptors` | Webex service backends | See Protocol and wire format | `src/interceptors/webex-tracking-id.js`, `src/interceptors/webex-user-agent.js`, `src/interceptors/auth.js`, `src/interceptors/redirect.js` |
|
|
163
|
+
| `sequenceNumbers` | `webex-core-interceptors` | Tests | Exported map keyed by interceptor instance; re-exported by the package under the name `webexTrackingIdSequenceNumbers` | `src/interceptors/webex-tracking-id.js` |
|
|
164
|
+
|
|
165
|
+
The module provides `webex-core-interceptors` and requires `http-core-sdk`, `webex-common-js-api`,
|
|
166
|
+
`webex-core-credentials`, and `webex-core-services`. The repository-wide index of contract ids is
|
|
167
|
+
[Public and consumer surfaces](../../../docs/architecture.md#public-and-consumer-surfaces).
|
|
168
|
+
|
|
169
|
+
### Configuration surface
|
|
170
|
+
|
|
171
|
+
Defaults live in `src/config.js`. Keys that govern chain assembly are owned by the parent spec
|
|
172
|
+
([`src/docs/README.md`](../../docs/README.md)) and are not restated here: `config.interceptors`
|
|
173
|
+
(`MOD-022`), `config.services.validateCatalogUrls` (`MOD-025`), the `ENABLE_NETWORK_LOGGING` and
|
|
174
|
+
`ENABLE_VERBOSE_NETWORK_LOGGING` switches (`MOD-024`), and the tracking-id prefix keys (`MOD-029`). The
|
|
175
|
+
keys below are read by the interceptors themselves.
|
|
176
|
+
|
|
177
|
+
| Key | Read by | Effect | Default |
|
|
178
|
+
| --- | --- | --- | --- |
|
|
179
|
+
| `config.maxAuthenticationReplays` | `src/interceptors/auth.js` | Ceiling on 401 replays per request | `1` |
|
|
180
|
+
| `config.maxAppLevelRedirects` | `src/interceptors/redirect.js` | Ceiling for `cisco-location` header redirects | `10` |
|
|
181
|
+
| `config.maxLocusRedirects` | `src/interceptors/redirect.js` | Ceiling for Locus and App API body redirects | `5` |
|
|
182
|
+
| `config.defaultRequestOptions` | `src/interceptors/default-options.js` | Options merged into requests that lack the key | unset |
|
|
183
|
+
| `config.proxy` | `src/interceptors/proxy.js` | Value assigned to `options.proxy` in Node | unset |
|
|
184
|
+
| `config.appName`, `config.appVersion`, `config.appPlatform` | `src/interceptors/user-agent.js`, `src/interceptors/webex-user-agent.js` | Application identity in both user-agent headers | unset; version falls back to `0.0` |
|
|
185
|
+
| `config.credentials.samlUrl`, `tokenUrl`, `authorizeUrl` | `src/interceptors/redirect.js`, `src/interceptors/webex-user-agent.js` | URLs exempted from redirect-header and spark-user-agent injection | from the credentials config |
|
|
186
|
+
| `config.payloadTransformer.skipRepeatedInboundTransforms` | `src/interceptors/payload-transformer.js` | Runs the inbound transform at most once per response object | `false` |
|
|
187
|
+
|
|
188
|
+
## Dependencies
|
|
189
|
+
|
|
190
|
+
| Dependency | Why it is required | Failure behavior |
|
|
191
|
+
| --- | --- | --- |
|
|
192
|
+
| http-core `Interceptor` base class (see its specification) | Supplies the four pass-through hooks, attribute injection by constructor, and `create()` | `create()` throws if a subclass omits it; the chain fold routes a hook rejection to the next interceptor's error hook |
|
|
193
|
+
| `webex.credentials` | `AuthInterceptor` reads `getUserToken()`, `canRefresh`, `refresh()`; `EmbargoInterceptor` calls `clear()` | A rejection from `getUserToken()` or `refresh()` propagates out of the hook |
|
|
194
|
+
| `webex.internal.services` | `AuthInterceptor` and `CatalogUrlInterceptor` use `getServiceFromUrl`, `waitForService`, `validateDomains`, `hasAllowedDomains`, `isAllowedDomainUrl` | Absent services: auth skips the header; catalog validation logs a warning and allows. A `waitForService` rejection is logged and treated as "no credentials" |
|
|
195
|
+
| `webex.internal.device` | `EmbargoInterceptor` clears it when mounted | Skipped when the plugin is absent |
|
|
196
|
+
| webex.request | `AuthInterceptor.replay` and `RedirectInterceptor` re-enter the full chain | Their result or rejection becomes the hook's result |
|
|
197
|
+
| `webex.transform` | `PayloadTransformerInterceptor` | A transform rejection propagates; the repeated-inbound guard clears its memo first |
|
|
198
|
+
| `webex.logger` | All logging interceptors and `AuthInterceptor` | Logging interceptors fall back to `console`; `CatalogUrlInterceptor` uses optional chaining |
|
|
199
|
+
| `webex.trigger` | `RequestEventInterceptor` | A throwing event handler is caught and logged at `warn` |
|
|
200
|
+
| the common-package `inBrowser` and `isBuffer` (see its specification) | Skip proxy and `user-agent` in browsers; label `webex-user-agent` platform; detect file bodies in logs | Load-time dependency |
|
|
201
|
+
| `lodash` | `get`, `has`, `omit`, `clone`, `isArray`, `isString` | Load-time dependency; read from code, no spec |
|
|
202
|
+
| `util` (Node built-in) | `util.inspect` in the two loggers | Polyfilled by bundlers |
|
|
203
|
+
| Identity broker service (`idbroker-oauth-service`) | Named by `RateLimitInterceptor` and `RedirectInterceptor` as URL patterns; `AuthInterceptor` reaches it indirectly through credentials refresh | Not called directly from this module |
|
|
204
|
+
|
|
205
|
+
## Requirements
|
|
206
|
+
|
|
207
|
+
| ID | WHAT | WHY | Source evidence | Test or example evidence | Assumptions or gaps | Confidence |
|
|
208
|
+
| --- | --- | --- | --- | --- | --- | --- |
|
|
209
|
+
| `INT-001` | `AuthInterceptor` leaves the request untouched when `options.headers` already holds an `authorization` key or `options.auth` is present; a falsy `authorization` value is deleted | A caller-supplied credential must win, and a null header must not trigger a CORS preflight | `src/interceptors/auth.js` | `test/unit/spec/interceptors/auth.js` | none | Present |
|
|
210
|
+
| `INT-002` | `AuthInterceptor` sets `authorization` to `webex.credentials.getUserToken()` stringified only when `requiresCredentials` resolves true | Only requests bound for Webex services should carry the user token | `src/interceptors/auth.js` | `test/unit/spec/interceptors/auth.js` | none | Present |
|
|
211
|
+
| `INT-003` | `requiresCredentials` resolves false when `options.addAuthHeader === false` or when the services plugin is not mounted | Lets callers opt out, and avoids a catalog lookup before the plugin exists | `src/interceptors/auth.js` | `test/unit/spec/interceptors/auth.js` | none | Present |
|
|
212
|
+
| `INT-004` | The `u2c` service (by `options.service`, `options.api`, or URL match) requires credentials unless `options.resource` or `options.uri` contains `limited` | The limited U2C catalog is the unauthenticated bootstrap path | `src/interceptors/auth.js` | `test/unit/spec/interceptors/auth.js` | none | Present |
|
|
213
|
+
| `INT-005` | A URL under a configured allowed domain requires credentials when `services.validateDomains` is on and allowed domains exist | Extends the token to customer-approved hosts outside the catalog | `src/interceptors/auth.js` | `test/unit/spec/interceptors/auth.js` | none | Present |
|
|
214
|
+
| `INT-006` | Otherwise `requiresCredentials` awaits `services.waitForService({name, url})` and is true only if the resolved URL maps to a catalog service; a rejection is logged at `warn` and yields false | A request whose service has not loaded yet must wait for the catalog rather than go out unauthenticated; a failure must not block the request | `src/interceptors/auth.js` | `test/unit/spec/interceptors/auth.js` | The failure branch is exercised only indirectly | Present |
|
|
215
|
+
| `INT-007` | On a 401, unless `options.shouldRefreshAccessToken === false`, `AuthInterceptor` deletes `authorization` from `reason.options.headers`, calls `credentials.refresh()` when `canRefresh`, then replays | A stale token should be replaced once without surfacing the 401 | `src/interceptors/auth.js` | `test/unit/spec/interceptors/auth.js`, `test/integration/spec/unit-browser/auth.js` | none | Present |
|
|
216
|
+
| `INT-008` | A non-refreshable 401, a non-401 error, or an opted-out request re-rejects the original reason | Callers must see the server's error when no recovery is possible | `src/interceptors/auth.js` | `test/unit/spec/interceptors/auth.js` | none | Present |
|
|
217
|
+
| `INT-009` | `replay` increments `options.replayCount` and rejects with `Error('Failed after N replay attempts')` once the count exceeds `config.maxAuthenticationReplays`; otherwise it calls `webex.request(options)` | Bounds the refresh-and-retry loop | `src/interceptors/auth.js`, `src/config.js` | none found | Gap: the over-limit branch is not asserted; see the second-401 pitfall | Present |
|
|
218
|
+
| `INT-010` | `CatalogUrlInterceptor` passes a request that has `options.service` and no URI or URL, and a request with no URL at all | A service-addressed request is resolved to a URL later in the chain, by the services interceptor | `src/interceptors/catalog-url.js` | `test/unit/spec/interceptors/catalog-url.js` | none | Present |
|
|
219
|
+
| `INT-011` | `CatalogUrlInterceptor` passes a URL that `services.getServiceFromUrl` recognizes, or one that `isAllowedDomainUrl` accepts when `validateDomains` is on and allowed domains exist, and otherwise rejects with `Request blocked: URL not in service catalog or allowed domains: <url>.` | Blocks request-forgery through attacker-supplied URLs, for example ones injected from server messages | `src/interceptors/catalog-url.js` | `test/unit/spec/interceptors/catalog-url.js` | none | Present |
|
|
220
|
+
| `INT-012` | `CatalogUrlInterceptor` allows the request and logs a `warn` when the services plugin is not mounted | The catalog cannot be consulted, and failing closed would break startup | `src/interceptors/catalog-url.js` | `test/unit/spec/interceptors/catalog-url.js` | The `warn` call is not asserted | Present |
|
|
221
|
+
| `INT-013` | Whether `CatalogUrlInterceptor` is in the chain at all is decided by the parent (`MOD-025`: only when `config.services.validateCatalogUrls === true`); this module owns only what it does once present (`INT-010` to `INT-012`) | Opt-in gate is chain assembly, not interceptor behavior; recorded once in the parent | `src/interceptors/catalog-url.js` | `test/unit/spec/interceptors/catalog-url.js` | Gate and its tests are parent-owned (`MOD-025`) | Present |
|
|
222
|
+
| `INT-014` | `DefaultOptionsInterceptor` copies each `config.defaultRequestOptions` key onto the request unless the request already has that key | Lets an integrator set, for example, a global `timeout` without overriding per-call values | `src/interceptors/default-options.js` | `test/unit/spec/interceptors/default-options.js` | none | Present |
|
|
223
|
+
| `INT-015` | `EmbargoInterceptor` on a 451 clears `webex.internal.device` when mounted and `webex.credentials`, logs at `info`, and rejects with the original reason; other statuses are re-rejected untouched | A legally embargoed client must drop its registration and tokens | `src/interceptors/embargo.js` | `test/unit/spec/interceptors/embargo.js` | none | Present |
|
|
224
|
+
| `INT-016` | `NetworkTimingInterceptor` sets `$timings.networkStart` on request and `$timings.networkEnd` on response and on response error | Separates wire time from interceptor-processing time | `src/interceptors/network-timing.js` | `test/unit/spec/interceptors/network-timing.js` | Gap: the response-error branch is not tested | Present |
|
|
225
|
+
| `INT-017` | `RequestTimingInterceptor` sets `requestStart` on request, `requestEnd` on response, and `requestEnd` plus `requestFail` on a request or response error | Gives total elapsed time and a failure marker | `src/interceptors/request-timing.js` | `test/unit/spec/interceptors/request-timing.js` | none | Present |
|
|
226
|
+
| `INT-018` | `PayloadTransformerInterceptor` runs `webex.transform('outbound', options)` unless `options.noTransform`, `transform('inbound', response)` unless `options.disableTransform`, and `transform('inbound', reason)` on errors, rejecting with the transformed reason | Encryption and similar plugin transforms apply uniformly on both directions, including error bodies | `src/interceptors/payload-transformer.js` | `test/unit/spec/interceptors/payload-transformer.js` | Gap: the `noTransform` and `disableTransform` outputs are only partly asserted | Present |
|
|
227
|
+
| `INT-019` | When `config.payloadTransformer.skipRepeatedInboundTransforms` is on, the first inbound transform for a response object is memoized as a non-enumerable property, shared by concurrent callers, and discarded if it rejects; a response with `disableTransform` is not marked | The same response may traverse more than one pipeline, and decrypting twice would corrupt it | `src/interceptors/payload-transformer.js`, `src/config.js` | `test/unit/spec/interceptors/payload-transformer.js` | none | Present |
|
|
228
|
+
| `INT-020` | `ProxyInterceptor` assigns `options.proxy` from `config.proxy` in Node only; it assigns nothing in a browser or when no proxy is configured | Browsers cannot set a proxy; Node needs one injected | `src/interceptors/proxy.js` | `test/unit/spec/interceptors/proxy.js` | none | Present |
|
|
229
|
+
| `INT-021` | `RateLimitInterceptor` rejects with `API rate limited <uri>` a request whose URI contains `idbroker` or `identity` while an expiry is recorded for it | Avoids hammering the identity API during a 429 window | `src/interceptors/rate-limit.js` | `test/unit/spec/interceptors/rate-limit.js` | Defect: the expiry can never be recorded, see Pitfalls; the positive-case tests are skipped | Weak |
|
|
230
|
+
| `INT-022` | `extractRetryAfterTime` returns 60000 ms when the header is absent or not positive, 3600000 ms when it exceeds 3600 s, and otherwise the header value in ms | Bounds the block window to a sane range | `src/interceptors/rate-limit.js` | `test/unit/spec/interceptors/rate-limit.js` | none | Present |
|
|
231
|
+
| `INT-023` | `RedirectInterceptor` sets the request header `cisco-no-http-redirect: true` and initializes $redirectCount to `0` unless the URI contains `https://idbroker` or one of the configured SAML, token, or authorize URLs, or the caller already set the header (a falsy value deletes it) | The service must answer with a redirect instruction the SDK follows itself, so authorization and routing stay under SDK control | `src/interceptors/redirect.js` | none found | Gap: the request side is untested | Present |
|
|
232
|
+
| `INT-024` | A response carrying a `cisco-location` header is re-issued to that URI with $redirectCount incremented, and rejects with `Maximum redirects exceeded` above `config.maxAppLevelRedirects` | Follows service-directed relocation with a bound | `src/interceptors/redirect.js`, `src/config.js` | none found | Gap: no test covers the header form | Present |
|
|
233
|
+
| `INT-025` | A response body with `errorCode` `2000002` and a `location` is re-issued to that location, with its query string dropped when the original request used `qs`, bounded by `config.maxLocusRedirects` | The Locus service signals a home-cluster change in the body of a 404 that the status interceptor passes through | `src/interceptors/redirect.js`, `src/config.js` | `test/unit/spec/interceptors/redirect.js` | none | Present |
|
|
234
|
+
| `INT-026` | A response body with `code` `404100` and `data.siteFullUrl` is re-issued with the host replaced (GET) or the URL replaced (POST with `qs`), bounded by `config.maxLocusRedirects`; for `resource: 'preJoin'` on `service: 'webex-appapi-service'` the `authorization` header is set to `false` | The App API redirects to another site, and the pre-join call must not send the token there | `src/interceptors/redirect.js`, `src/config.js` | `test/unit/spec/interceptors/redirect.js` | none | Present |
|
|
235
|
+
| `INT-027` | `RequestEventInterceptor` triggers `request:start` on request, `request:success` with `response.options` and the response on success, and `request:end` plus `request:failure` on a request or response error; a throwing handler is caught and logged | Metrics and diagnostics subscribe without being able to break a request | `src/interceptors/request-event.js` | none found | Gap: no unit test covers this file | Present |
|
|
236
|
+
| `INT-028` | `WebexTrackingIdInterceptor` sets `trackingid` to `<webex.sessionId>_<n>` with a per-instance counter that increments on each access, keeps a caller-supplied value, and deletes a falsy one | Correlates a request across client and server logs, and a null header avoids a preflight | `src/interceptors/webex-tracking-id.js` | `test/unit/spec/interceptors/webex-tracking-id.js` | none | Present |
|
|
237
|
+
| `INT-029` | When `options.replayCount` is set and a tracking id exists, the second `+`-delimited segment is set to the replay count | Distinguishes a replay from the original in server logs | `src/interceptors/webex-tracking-id.js` | none found | Gap: untested | Present |
|
|
238
|
+
| `INT-030` | `WebexUserAgentInterceptor` sets `spark-user-agent` to `<webex or webex-js-sdk>/<version> (<web or node>)`, plus ` appName/appVersion` and ` appPlatform` when configured; a caller value is kept and a falsy one deleted; token, SAML, authorize, and `https://idbroker` URLs are skipped | Identifies the SDK and host app; the identity endpoints are excluded by design | `src/interceptors/webex-user-agent.js` | `test/unit/spec/interceptors/webex-user-agent.js` | Gap: the skip for identity URLs is untested | Present |
|
|
239
|
+
| `INT-031` | `UserAgentInterceptor` sets `user-agent` in Node to `appName/appVersion` when `appName` is set, else `@webex/http-core`, unless both `user-agent` and `spark-user-agent` are already present; it never sets it in a browser | Browsers forbid overriding that header | `src/interceptors/user-agent.js` | `test/unit/spec/interceptors/user-agent.js` | none | Present |
|
|
240
|
+
| `INT-032` | The two logger interceptors are registered only when `ENABLE_NETWORK_LOGGING` or `ENABLE_VERBOSE_NETWORK_LOGGING` is set at load; verbose dumps additionally need the verbose switch, omit a non-array, non-string request body, and replace string or buffer response bodies with a placeholder | Full dumps contain secrets and payloads and must stay off by default | `src/interceptors/request-logger.js`, `src/interceptors/response-logger.js`, `src/webex-core.js` | none found | Gap: no unit test covers either logger | Present |
|
|
241
|
+
| `INT-033` | Interceptor ordering is parent-owned (`MOD-023`); the effect on this module is that pre-group hooks bracket all others, `HttpStatusInterceptor` sits closest to the transport so later error hooks see typed errors, and `RateLimitInterceptor` is instantiated in both groups | Every hook's correctness depends on its position, but the lists are recorded once in the parent | `src/webex-core.js` | `test/unit/spec/webex-core.js` | Wiring and group lists are owned by `MOD-023` | Present |
|
|
242
|
+
|
|
243
|
+
## Design overview
|
|
244
|
+
|
|
245
|
+
The module is a set of independent single-purpose classes sharing one convention: a hook receives the
|
|
246
|
+
mutable options object (or response or error), mutates or inspects it, and returns it, a response, or
|
|
247
|
+
a rejected promise. None of them holds a reference to another; all coupling is through fields on the
|
|
248
|
+
options object (`$timings`, `$redirectCount`, `replayCount`, `headers`) and through the shared
|
|
249
|
+
`webex` instance injected by `create()`.
|
|
250
|
+
|
|
251
|
+
**Ordering is the design.** `src/webex-core.js` builds the chain in three groups (parent `MOD-023`). The
|
|
252
|
+
http-core fold runs request hooks in array order and response hooks in reverse, so the pre group is
|
|
253
|
+
the outermost layer: its request hooks run first, its response hooks last. That is why
|
|
254
|
+
`ResponseLoggerInterceptor` and `RequestTimingInterceptor` are first in the array. By the time their
|
|
255
|
+
response hooks run, `NetworkTimingInterceptor.onResponse` and the redirect and payload hooks have
|
|
256
|
+
completed and `$timings` is fully populated. `HttpStatusInterceptor` is first of the post group, so
|
|
257
|
+
its `onResponse` runs first on the way back and converts a failing status into a rejection that every
|
|
258
|
+
other interceptor's `onResponseError` then sees. `RateLimitInterceptor` appears in both the pre and
|
|
259
|
+
post groups, so two instances with independent state exist; each sees every rejection on the response
|
|
260
|
+
path.
|
|
261
|
+
|
|
262
|
+
**Re-entry instead of a retry loop.** Neither `AuthInterceptor` nor `RedirectInterceptor` retries
|
|
263
|
+
internally. Both call `webex.request(options)`, which runs the entire chain a second time on the same
|
|
264
|
+
options object, and the nested result becomes the outer hook's result. The ceilings
|
|
265
|
+
(`maxAuthenticationReplays`, `maxAppLevelRedirects`, `maxLocusRedirects`) are counters on the options
|
|
266
|
+
object (`replayCount`, `$redirectCount`) that survive re-entry because the options are reused or
|
|
267
|
+
shallow-cloned.
|
|
268
|
+
|
|
269
|
+
**Two generations of factory.** Most classes build themselves with
|
|
270
|
+
`new X({webex: this})` so that the base class defines `webex` on the instance. `NetworkTimingInterceptor`
|
|
271
|
+
and `RequestTimingInterceptor` instead call `new X(this, options)`, passing the webex instance itself as
|
|
272
|
+
the attributes bag, which copies webex's own enumerable keys onto the interceptor and leaves
|
|
273
|
+
`this.webex` undefined. This works only because those two never read `this.webex`.
|
|
274
|
+
|
|
275
|
+
**State is tiny and instance-scoped.** `WeakMap`s hold the computed user-agent and proxy strings and the
|
|
276
|
+
rate-limit expiry map; a module-level `Map` holds tracking-id counters. Nothing is persisted.
|
|
277
|
+
|
|
278
|
+
## Data flow and sequence coverage
|
|
279
|
+
|
|
280
|
+
The transport is HTTP, driven by the http-core fold. Operation groups with different actors, ordering,
|
|
281
|
+
or failure outcomes are diagrammed separately: header and request preparation, response conversion and
|
|
282
|
+
error side effects, the 401 refresh-and-replay loop, the redirect loop, and the inbound payload
|
|
283
|
+
transform.
|
|
284
|
+
|
|
285
|
+
| Operation group | Entry and outcome | Diagram or evidence | Failure and recovery coverage |
|
|
286
|
+
| --- | --- | --- | --- |
|
|
287
|
+
| Request preparation | Options flow forward through the chain; headers, timings, and guards applied | Diagram 1 | `RateLimitInterceptor` and `CatalogUrlInterceptor` reject before the transport; request-error hooks of `RequestEventInterceptor`, `RequestTimingInterceptor`, and `RequestLoggerInterceptor` observe the rejection |
|
|
288
|
+
| Response conversion and error side effects | Status interceptor converts, then error hooks run in reverse | Diagram 2 | 451 clears state; 429 records an expiry (see Pitfalls); everything else re-rejects |
|
|
289
|
+
| Authentication replay | 401 triggers refresh, then the whole chain re-runs | Diagram 3 | Not refreshable, opted out, or over the ceiling: reject |
|
|
290
|
+
| Redirect following | Redirect-shaped success response re-issues the request | Diagram 4 | Over the ceiling: `Maximum redirects exceeded` |
|
|
291
|
+
| Inbound payload transform | Response and error bodies pass through `webex.transform` | `src/interceptors/payload-transformer.js`, `test/unit/spec/interceptors/payload-transformer.js` | Memo cleared on rejection |
|
|
292
|
+
|
|
293
|
+
**1. Request preparation**
|
|
294
|
+
|
|
295
|
+
```mermaid
|
|
296
|
+
sequenceDiagram
|
|
297
|
+
participant F as http-core fold
|
|
298
|
+
participant Pre as pre group
|
|
299
|
+
participant Mid as middle group
|
|
300
|
+
participant Post as post group
|
|
301
|
+
participant T as transport
|
|
302
|
+
F->>Pre: onRequest in array order
|
|
303
|
+
Pre->>Pre: RequestTiming stamps requestStart
|
|
304
|
+
Pre->>Pre: RequestEvent triggers request:start
|
|
305
|
+
Pre->>Pre: WebexTrackingId sets trackingid
|
|
306
|
+
alt API is rate limited
|
|
307
|
+
Pre-->>F: reject API rate limited
|
|
308
|
+
else catalog validation on and URL unknown
|
|
309
|
+
Pre-->>F: reject Request blocked
|
|
310
|
+
end
|
|
311
|
+
F->>Mid: onRequest
|
|
312
|
+
Mid->>Mid: ServiceInterceptor resolves service to URL
|
|
313
|
+
Mid->>Mid: user-agent, proxy, spark-user-agent, authorization
|
|
314
|
+
Mid->>Mid: payload outbound transform, no-redirect header, default options
|
|
315
|
+
F->>Post: onRequest
|
|
316
|
+
Post->>Post: NetworkTiming stamps networkStart
|
|
317
|
+
Post->>Post: RequestLogger logs the request
|
|
318
|
+
F->>T: dispatch
|
|
319
|
+
Note over F,Pre: on any request rejection each later onRequestError runs: RequestEvent triggers request:end and request:failure, RequestTiming stamps requestFail, RequestLogger logs the stack
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
**2. Response conversion and error side effects**
|
|
323
|
+
|
|
324
|
+
```mermaid
|
|
325
|
+
sequenceDiagram
|
|
326
|
+
participant T as transport
|
|
327
|
+
participant H as HttpStatusInterceptor
|
|
328
|
+
participant N as NetworkTiming
|
|
329
|
+
participant E as Embargo
|
|
330
|
+
participant R as RateLimit post
|
|
331
|
+
participant Mid as middle group reversed
|
|
332
|
+
participant Pre as pre group reversed
|
|
333
|
+
T-->>H: response
|
|
334
|
+
alt status below 400 or redirect body
|
|
335
|
+
H-->>N: onResponse, networkEnd stamped
|
|
336
|
+
N-->>Mid: Redirect, PayloadTransformer inbound
|
|
337
|
+
Mid-->>Pre: RequestEvent triggers request:success, RequestTiming stamps requestEnd, ResponseLogger logs
|
|
338
|
+
else status 400 or above
|
|
339
|
+
H-->>N: reject typed error
|
|
340
|
+
N->>N: networkEnd stamped
|
|
341
|
+
N-->>E: onResponseError
|
|
342
|
+
alt statusCode 451
|
|
343
|
+
E->>E: clear device and credentials
|
|
344
|
+
end
|
|
345
|
+
E-->>R: reject
|
|
346
|
+
R->>R: on 429 for an identity URL record expiry
|
|
347
|
+
R-->>Mid: Auth, PayloadTransformer inbound on the error
|
|
348
|
+
Mid-->>Pre: RequestEvent triggers request:end and request:failure, RequestTiming stamps requestFail, ResponseLogger logs
|
|
349
|
+
end
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
**3. Authentication replay**
|
|
353
|
+
|
|
354
|
+
```mermaid
|
|
355
|
+
sequenceDiagram
|
|
356
|
+
participant A as AuthInterceptor
|
|
357
|
+
participant C as webex.credentials
|
|
358
|
+
participant W as webex.request
|
|
359
|
+
A->>A: onResponseError with a 401 reason
|
|
360
|
+
alt shouldRefreshAccessToken is false or status is not 401
|
|
361
|
+
A-->>A: reject reason
|
|
362
|
+
else canRefresh is false
|
|
363
|
+
A-->>A: reject reason
|
|
364
|
+
else refresh and replay
|
|
365
|
+
A->>A: delete authorization from reason.options.headers
|
|
366
|
+
A->>C: refresh
|
|
367
|
+
C-->>A: refreshed
|
|
368
|
+
A->>A: replayCount incremented
|
|
369
|
+
alt replayCount above maxAuthenticationReplays
|
|
370
|
+
A-->>A: reject Failed after N replay attempts
|
|
371
|
+
else
|
|
372
|
+
A->>W: request(options), entire chain re-runs
|
|
373
|
+
W-->>A: response or rejection becomes the result
|
|
374
|
+
end
|
|
375
|
+
end
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
**4. Redirect following**
|
|
379
|
+
|
|
380
|
+
```mermaid
|
|
381
|
+
sequenceDiagram
|
|
382
|
+
participant R as RedirectInterceptor
|
|
383
|
+
participant W as webex.request
|
|
384
|
+
R->>R: onResponse
|
|
385
|
+
alt cisco-location header present
|
|
386
|
+
R->>R: clone options, uri from header, count plus 1
|
|
387
|
+
Note over R: limit maxAppLevelRedirects
|
|
388
|
+
else body errorCode 2000002 with location
|
|
389
|
+
R->>R: clone options, uri from location, qs-bearing request drops query, count plus 1
|
|
390
|
+
Note over R: limit maxLocusRedirects
|
|
391
|
+
else body code 404100 with data.siteFullUrl
|
|
392
|
+
R->>R: clone options, rewrite host or URL, preJoin on webex-appapi-service drops authorization, count plus 1
|
|
393
|
+
Note over R: limit maxLocusRedirects
|
|
394
|
+
else no redirect shape
|
|
395
|
+
R-->>R: return response
|
|
396
|
+
end
|
|
397
|
+
alt count above limit
|
|
398
|
+
R-->>R: reject Maximum redirects exceeded
|
|
399
|
+
else
|
|
400
|
+
R->>W: request(options)
|
|
401
|
+
W-->>R: result becomes the response
|
|
402
|
+
end
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
## Class and component relationships
|
|
406
|
+
|
|
407
|
+
```mermaid
|
|
408
|
+
classDiagram
|
|
409
|
+
class Interceptor {
|
|
410
|
+
<<http-core base>>
|
|
411
|
+
+onRequest(options)
|
|
412
|
+
+onRequestError(options, reason)
|
|
413
|
+
+onResponse(options, response)
|
|
414
|
+
+onResponseError(options, reason)
|
|
415
|
+
+logOptions(options)
|
|
416
|
+
+create()$
|
|
417
|
+
}
|
|
418
|
+
class WebexCore {
|
|
419
|
+
+request
|
|
420
|
+
+sessionId
|
|
421
|
+
+transform(direction, object)
|
|
422
|
+
}
|
|
423
|
+
Interceptor <|-- AuthInterceptor
|
|
424
|
+
Interceptor <|-- CatalogUrlInterceptor
|
|
425
|
+
Interceptor <|-- DefaultOptionsInterceptor
|
|
426
|
+
Interceptor <|-- EmbargoInterceptor
|
|
427
|
+
Interceptor <|-- NetworkTimingInterceptor
|
|
428
|
+
Interceptor <|-- PayloadTransformerInterceptor
|
|
429
|
+
Interceptor <|-- ProxyInterceptor
|
|
430
|
+
Interceptor <|-- RateLimitInterceptor
|
|
431
|
+
Interceptor <|-- RedirectInterceptor
|
|
432
|
+
Interceptor <|-- RequestEventInterceptor
|
|
433
|
+
Interceptor <|-- RequestLoggerInterceptor
|
|
434
|
+
Interceptor <|-- RequestTimingInterceptor
|
|
435
|
+
Interceptor <|-- ResponseLoggerInterceptor
|
|
436
|
+
Interceptor <|-- UserAgentInterceptor
|
|
437
|
+
Interceptor <|-- WebexTrackingIdInterceptor
|
|
438
|
+
Interceptor <|-- WebexUserAgentInterceptor
|
|
439
|
+
WebexCore ..> Interceptor : builds chain via create()
|
|
440
|
+
AuthInterceptor --> WebexCore : credentials, services, request
|
|
441
|
+
RedirectInterceptor --> WebexCore : request
|
|
442
|
+
EmbargoInterceptor --> WebexCore : credentials, device
|
|
443
|
+
PayloadTransformerInterceptor --> WebexCore : transform
|
|
444
|
+
RequestEventInterceptor --> WebexCore : trigger
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
Timing state is the one cross-class dependency: `ResponseLoggerInterceptor` reads `$timings` values
|
|
448
|
+
that `RequestTimingInterceptor` and `NetworkTimingInterceptor` write, and throws if they were not
|
|
449
|
+
registered ahead of it (see Pitfalls).
|
|
450
|
+
|
|
451
|
+
## Use cases and flows
|
|
452
|
+
|
|
453
|
+
| Use case | Actor or caller | Primary steps and outcome | Failure or boundary behavior | Evidence |
|
|
454
|
+
| --- | --- | --- | --- | --- |
|
|
455
|
+
| `UC-001` | Plugin calling a catalog service | `trackingid`, `spark-user-agent`, and `authorization` are added, the request goes out, and a typed response returns | A service not yet in the catalog makes `requiresCredentials` wait on `waitForService` | `src/interceptors/auth.js`, `test/unit/spec/interceptors/auth.js` |
|
|
456
|
+
| `UC-002` | Plugin whose token expired | The server answers 401, the token is refreshed, and the request is replayed with `trackingid` suffixed by the replay count | A second 401 rejects with `Failed after 1 replay attempts` (see the second-401 pitfall) | `src/interceptors/auth.js`, `src/interceptors/webex-tracking-id.js`, `test/integration/spec/unit-browser/auth.js` |
|
|
457
|
+
| `UC-003` | Integrator with strict egress | Sets `services.validateCatalogUrls: true`; a request to an unknown host is rejected before dispatch | Allowed domains are honored; a request addressed by `service` and no URL is not blocked here | `src/interceptors/catalog-url.js`, `test/unit/spec/interceptors/catalog-url.js` |
|
|
458
|
+
| `UC-004` | Integrator setting a global timeout | Sets `defaultRequestOptions.timeout`; requests without their own `timeout` inherit it | A key already on the request, even with a falsy value, is kept | `src/interceptors/default-options.js`, `test/unit/spec/interceptors/default-options.js` |
|
|
459
|
+
| `UC-005` | Meetings plugin joining a locus | Locus answers a 404 with a redirect body; the status interceptor lets it through and `RedirectInterceptor` re-issues the request | After five redirects the request rejects with `Maximum redirects exceeded` | `src/interceptors/redirect.js`, `test/unit/spec/interceptors/redirect.js` |
|
|
460
|
+
| `UC-006` | Embargoed user | A 451 reply clears credentials and device; the caller still receives the rejection | None; the clear is unconditional on status | `src/interceptors/embargo.js`, `test/unit/spec/interceptors/embargo.js` |
|
|
461
|
+
| `UC-007` | Metrics plugin | Subscribes to `request:start`, `request:success`, `request:failure` and receives options, responses, and errors | A subscriber that throws is caught and logged | `src/interceptors/request-event.js` |
|
|
462
|
+
| `UC-008` | Developer debugging a network call | Sets `ENABLE_NETWORK_LOGGING` or the verbose switch before load; status, tracking id, and durations are logged | With neither switch the logger interceptors are absent from the chain | `src/interceptors/request-logger.js`, `src/interceptors/response-logger.js`, `src/webex-core.js` |
|
|
463
|
+
|
|
464
|
+
### Cross-boundary use-case flow
|
|
465
|
+
|
|
466
|
+
| Boundary | Transport | Ordering | Compatibility | Timeout and retry | Recovery |
|
|
467
|
+
| --- | --- | --- | --- | --- | --- |
|
|
468
|
+
| SDK to identity broker (token refresh via credentials) | HTTP through `webex.credentials.refresh()`, not directly from this module | Refresh completes before the replay is issued | Header names are server contracts | Replay bounded by `maxAuthenticationReplays`; no timeout of its own | Over the ceiling the replay is refused; a failing refresh rejects the outer request |
|
|
469
|
+
| SDK to Locus or App API redirect target | HTTP through webex.request | The redirected request runs the whole chain, including `RedirectInterceptor` again | The body codes `2000002` and `404100` are service contracts | Bounded by `maxLocusRedirects`; none on the header form beyond `maxAppLevelRedirects` | Over the ceiling: reject |
|
|
470
|
+
| SDK to service catalog | In-process call to `webex.internal.services` | Evaluated per request, before dispatch | Requires the services plugin for any validation | `waitForService` bounds its own wait | Failure logged; auth treats it as "no credentials" |
|
|
471
|
+
|
|
472
|
+
## Client state model
|
|
473
|
+
|
|
474
|
+
| State or slice | Owner | Initial state | Transition triggers | Reset or persistence boundary |
|
|
475
|
+
| --- | --- | --- | --- | --- |
|
|
476
|
+
| Rate-limit expiry map | `RateLimitInterceptor` instance | Empty map | A 429 on an identity-broker URL (see Pitfalls) | Lives with the instance; never persisted |
|
|
477
|
+
| Tracking-id sequence | `sequenceNumbers` map keyed by `WebexTrackingIdInterceptor` instance | Absent, read as 0 | Each read of `sequence` adds 1 | Lives with the process |
|
|
478
|
+
| Computed user-agent, proxy, and platform strings | `WeakMap` per file | Set in the constructor | Never changes after construction | Instance lifetime |
|
|
479
|
+
| $timings | The request options object | Created by the first timing interceptor | Each timing hook | Per request; carried into a replay or redirect because the options object is reused |
|
|
480
|
+
| $redirectCount, replayCount | The request options object | Absent or `0` | Each redirect or replay | Per request lineage |
|
|
481
|
+
| Inbound transform memo | The response object, non-enumerable | Absent | First inbound transform when the guard is on | Per response object |
|
|
482
|
+
|
|
483
|
+
## Business rules and invariants
|
|
484
|
+
|
|
485
|
+
| ID | Invariant | WHY | Enforcement source | Test evidence |
|
|
486
|
+
| --- | --- | --- | --- | --- |
|
|
487
|
+
| `INV-001` | When `validateCatalogUrls` is on, no request with a URL leaves the chain unless the catalog or allowed domains vouch for it | The SDK must not be steerable to attacker hosts | `src/interceptors/catalog-url.js`, `src/webex-core.js` | `test/unit/spec/interceptors/catalog-url.js` |
|
|
488
|
+
| `INV-002` | Caller-header-wins rule of `INT-001`, `INT-023`, `INT-028`, and `INT-030`: a caller-provided header is never overwritten and a falsy value removes it | Caller intent wins, and a header present with no value would force a CORS preflight | `src/interceptors/auth.js`, `src/interceptors/webex-tracking-id.js`, `src/interceptors/webex-user-agent.js`, `src/interceptors/redirect.js` | `test/unit/spec/interceptors/auth.js`, `test/unit/spec/interceptors/webex-tracking-id.js`, `test/unit/spec/interceptors/webex-user-agent.js` |
|
|
489
|
+
| `INV-003` | Replays never exceed `maxAuthenticationReplays` and redirects never exceed their configured ceilings | Prevents unbounded loops | `src/interceptors/auth.js`, `src/interceptors/redirect.js` | `test/unit/spec/interceptors/redirect.js` |
|
|
490
|
+
| `INV-004` | A 451 always clears credentials | A legally embargoed session must not persist tokens | `src/interceptors/embargo.js` | `test/unit/spec/interceptors/embargo.js` |
|
|
491
|
+
| `INV-005` | The pre-join App API redirect carries no authorization header | The token must not be sent to the redirected site for an unauthenticated pre-join | `src/interceptors/redirect.js` | `test/unit/spec/interceptors/redirect.js` |
|
|
492
|
+
|
|
493
|
+
## Concurrency and reactive flow
|
|
494
|
+
|
|
495
|
+
- **Execution model:** promise-based hooks on the host event loop. `AuthInterceptor` and
|
|
496
|
+
`RedirectInterceptor` call `webex.request`, so a single logical request can run the chain several
|
|
497
|
+
times, nested, within the outer response phase.
|
|
498
|
+
- **Ordering guarantees:** within one request, hooks run in the order given in parent `MOD-023`, forward for
|
|
499
|
+
requests and reverse for responses. There is no ordering across concurrent requests.
|
|
500
|
+
- **Idempotency and retry:** replay and redirect are the only retries, bounded by the counters on the
|
|
501
|
+
options object. Neither deduplicates concurrent requests, so two simultaneous 401s each call
|
|
502
|
+
`credentials.refresh()`; any coalescing is owned by the credentials module, not here.
|
|
503
|
+
- **Shared-state protection:** none is needed for per-request state. The tracking-id counter and
|
|
504
|
+
rate-limit map are plain in-memory structures with no locking; the event loop serializes their access.
|
|
505
|
+
The inbound-transform memo is the one deliberate share: concurrent pipelines get the same promise.
|
|
506
|
+
- **Blocking restrictions:** `requiresCredentials` may await `waitForService`, which delays the request
|
|
507
|
+
until the catalog resolves. Verbose logging uses synchronous `util.inspect` of the full options.
|
|
508
|
+
|
|
509
|
+
## Protocol and wire format
|
|
510
|
+
|
|
511
|
+
| Message or frame | Version | Producer or serializer | Consumer or parser | Compatibility and ordering rule |
|
|
512
|
+
| --- | --- | --- | --- | --- |
|
|
513
|
+
| Request header `authorization` | Token string from credentials | `src/interceptors/auth.js` | Webex services | Added after the service is resolved; skipped for `addAuthHeader: false` and the limited U2C path |
|
|
514
|
+
| Request header `trackingid` | `<sessionId>_<n>`, optional `+<replayCount>` | `src/interceptors/webex-tracking-id.js` | Webex services and log correlation | Counter is per interceptor instance |
|
|
515
|
+
| Request header `spark-user-agent` | `<lib>/<version> (<web or node>)` plus app suffix | `src/interceptors/webex-user-agent.js` | Webex services | Omitted for identity-broker and credential endpoints |
|
|
516
|
+
| Request header `user-agent` | `appName/appVersion` or `@webex/http-core` | `src/interceptors/user-agent.js` | Webex services | Node only |
|
|
517
|
+
| Request header `cisco-no-http-redirect` | `true` | `src/interceptors/redirect.js` | Webex services | Omitted for identity-broker and credential endpoints |
|
|
518
|
+
| Response header `cisco-location` | Absolute URI | Webex services | `src/interceptors/redirect.js` | Followed at most `maxAppLevelRedirects` times |
|
|
519
|
+
| Response body `errorCode: 2000002`, `location` | Locus redirect | Locus service | `src/interceptors/redirect.js` | Arrives on a 404 the status interceptor passes through |
|
|
520
|
+
| Response body `code: 404100`, `data.siteFullUrl` | App API redirect | App API service | `src/interceptors/redirect.js` | Arrives on a 404 the status interceptor passes through |
|
|
521
|
+
| Request header `retry-after` (read from the failed request's options, see Pitfalls) | Seconds | Not set by this module | `src/interceptors/rate-limit.js` | Clamped to 60 s to 3600 s |
|
|
522
|
+
|
|
523
|
+
## Caller-visible failure modes
|
|
524
|
+
|
|
525
|
+
| Condition | Signal or result | Caller behavior | Retry or recovery | Evidence |
|
|
526
|
+
| --- | --- | --- | --- | --- |
|
|
527
|
+
| URL not in catalog or allowed domains (opt-in) | Rejection `Request blocked: URL not in service catalog or allowed domains: <url>.` | Treat as a configuration or tampering error | Add the host to allowed domains | `src/interceptors/catalog-url.js`, `test/unit/spec/interceptors/catalog-url.js` |
|
|
528
|
+
| Identity API inside a recorded 429 window | Rejection `API rate limited <uri>` | Wait and retry | Window of 60 s to 3600 s; see Pitfalls on whether it can be recorded | `src/interceptors/rate-limit.js` |
|
|
529
|
+
| 401 and replay exhausted | Rejection `Failed after N replay attempts`, a plain `Error` rather than an HTTP error | Re-authenticate | None | `src/interceptors/auth.js` |
|
|
530
|
+
| 401 and not refreshable | The original HTTP error | Re-authenticate | None | `src/interceptors/auth.js`, `test/unit/spec/interceptors/auth.js` |
|
|
531
|
+
| Redirect ceiling exceeded | Rejection `Maximum redirects exceeded`, a plain `Error` | Treat as a service fault | None | `src/interceptors/redirect.js`, `test/unit/spec/interceptors/redirect.js` |
|
|
532
|
+
| 451 | The original error, after credentials and device are cleared | Treat the session as ended | Sign in again | `src/interceptors/embargo.js`, `test/unit/spec/interceptors/embargo.js` |
|
|
533
|
+
| Event handler throws | Swallowed, logged at `warn` | None | None | `src/interceptors/request-event.js` |
|
|
534
|
+
| Inbound transform rejects | The transform's rejection | Caller sees the transform error | Memo discarded so a later call retries | `src/interceptors/payload-transformer.js`, `test/unit/spec/interceptors/payload-transformer.js` |
|
|
535
|
+
|
|
536
|
+
## Pitfalls and constraints
|
|
537
|
+
|
|
538
|
+
- **Rate limiting cannot take effect as written.** `src/interceptors/rate-limit.js` extracts the API
|
|
539
|
+
name with a regex that requires the host to end in `ciscospark.com`, and returns capture group 2,
|
|
540
|
+
which is the optional `bts` group; the API name is group 3. For the hosts the tests use
|
|
541
|
+
(`idbroker.webex.com`, `identity.webex.com`) `getApiName` returns `null`, so `setRateLimitExpiry`
|
|
542
|
+
returns `false` and no window is ever opened. `onResponseError` also reads `retry-after` from the
|
|
543
|
+
request options' headers rather than the response. Ten tests that would assert the positive case are
|
|
544
|
+
`it.skip` in `test/unit/spec/interceptors/rate-limit.js`. Treat `INT-021` as inert until the regex and
|
|
545
|
+
group index are corrected.
|
|
546
|
+
- **`RateLimitInterceptor` is instantiated twice** because it is named in both the pre and post lists
|
|
547
|
+
in `src/webex-core.js`; the two instances do not share the expiry map.
|
|
548
|
+
- **`RequestTimingInterceptor.onRequestError` rejects with the options object, not the reason.**
|
|
549
|
+
`src/interceptors/request-timing.js` calls `Promise.reject(options)`, so a request-phase failure that
|
|
550
|
+
reaches it is replaced by the options in every later error hook and at the caller. It also reads
|
|
551
|
+
`options.$timings`, which is undefined if its own `onRequest` never ran.
|
|
552
|
+
- **`NetworkTimingInterceptor` and `RequestTimingInterceptor` pass `this` into the base constructor** in
|
|
553
|
+
`create()`, so they have no `webex` property and copy webex's own enumerable keys onto themselves.
|
|
554
|
+
Do not add code to them that reads `this.webex`.
|
|
555
|
+
- **`ResponseLoggerInterceptor` requires both timing interceptors.** It subtracts
|
|
556
|
+
`options.$timings.networkStart` and `requestStart`; with a custom `config.interceptors` that omits
|
|
557
|
+
either timing interceptor (or the logger registered without them), `printResponseHeader` throws on
|
|
558
|
+
an undefined `$timings`.
|
|
559
|
+
- **Redirect counting can be skipped.** `RedirectInterceptor.onRequest` returns before setting
|
|
560
|
+
`$redirectCount` for identity-broker and credential URLs and when the caller supplies the header.
|
|
561
|
+
A later redirect response then computes `undefined + 1`, which is `NaN`, and `NaN > max` is false, so
|
|
562
|
+
the ceiling never fires on such a request.
|
|
563
|
+
- **`RedirectInterceptor.onRequest` assumes `options.headers` exists.** It does not default it, unlike
|
|
564
|
+
the other header interceptors, so it relies on an earlier interceptor (`WebexTrackingIdInterceptor`)
|
|
565
|
+
having created it.
|
|
566
|
+
- **A second 401 refreshes before it is refused.** `AuthInterceptor.onResponseError` calls
|
|
567
|
+
`credentials.refresh()` and only then `replay`, which checks the ceiling, so with the default of `1`
|
|
568
|
+
a second 401 costs one more token refresh.
|
|
569
|
+
- **Redirect and replay re-run the whole chain.** `RequestEventInterceptor` therefore emits `request:*`
|
|
570
|
+
events for every leg, and metrics subscribers see each leg as a separate request. `RedirectInterceptor`
|
|
571
|
+
clones options shallowly, so the cloned request shares the original's `headers` object; clearing
|
|
572
|
+
`authorization` on a `preJoin` redirect also mutates the original request's headers.
|
|
573
|
+
- **`RequestLoggerInterceptor.onRequestError` calls `onRequest` without awaiting it** and reads
|
|
574
|
+
`reason.stack`, which is undefined for a non-`Error` rejection.
|
|
575
|
+
- **`WebexUserAgentInterceptor.onRequest` reads `this.webex.config.credentials`** without optional
|
|
576
|
+
chaining, though it reads other config with `?.`; a webex object with no credentials config throws.
|
|
577
|
+
- **Registry slots are reserved by key.** `ServiceInterceptor`, `KmsDryErrorInterceptor`, and
|
|
578
|
+
`ConversationInterceptor` are declared `undefined` in `src/webex-core.js` and filled by plugins
|
|
579
|
+
through `src/lib/webex-core-plugin-mixin.js`; their position in the middle group is the map's key
|
|
580
|
+
order. Moving a key changes where a plugin's interceptor runs.
|
|
581
|
+
- **`config.interceptors` bypasses the pre and post grouping.** `src/webex-core.js` then uses that
|
|
582
|
+
object's key order verbatim (still honoring the `CatalogUrlInterceptor` opt-in), so a custom set must
|
|
583
|
+
restate the order in parent `MOD-023` itself.
|
|
584
|
+
|
|
585
|
+
## Module-specific rules
|
|
586
|
+
|
|
587
|
+
- **Do:** return the options, response, or a promise of them from a hook, and reject with the original
|
|
588
|
+
reason from an error hook unless deliberately recovering, matching the base-class contract.
|
|
589
|
+
- **Do:** treat a caller-supplied header as authoritative and delete it when falsy, as the header
|
|
590
|
+
interceptors do, so callers can suppress a header without triggering a preflight.
|
|
591
|
+
- **Do:** register a new class by key in the map in `src/webex-core.js` and decide explicitly whether it
|
|
592
|
+
belongs in the pre or post list.
|
|
593
|
+
- **Do:** re-enter through `webex.request` only with a counter on the options object and a ceiling.
|
|
594
|
+
- **Do not:** make an interceptor depend on another's internal state; share only through documented
|
|
595
|
+
option fields.
|
|
596
|
+
- **Do not:** throw synchronously from a hook; return a rejected promise so the fold can route it.
|
|
597
|
+
- **Do not:** log request bodies or tokens outside the verbose switch.
|
|
598
|
+
|
|
599
|
+
## Export stability
|
|
600
|
+
|
|
601
|
+
| Export or entry point | Consumer | Stability | Versioning and deprecation rule | Declaration or API report |
|
|
602
|
+
| --- | --- | --- | --- | --- |
|
|
603
|
+
| `AuthInterceptor`, `CatalogUrlInterceptor`, `NetworkTimingInterceptor`, `PayloadTransformerInterceptor`, `RedirectInterceptor`, `ResponseLoggerInterceptor`, `RequestEventInterceptor`, `RequestLoggerInterceptor`, `RequestTimingInterceptor`, `UserAgentInterceptor`, `ProxyInterceptor`, `WebexTrackingIdInterceptor`, `WebexUserAgentInterceptor`, `RateLimitInterceptor`, `EmbargoInterceptor`, `DefaultOptionsInterceptor` | Plugins and integrators building a custom chain | Exported classes; no deprecation policy is declared in `package.json` or `src/index.js`, the package version governs | The class name is the key used in `config.interceptors`; hook signatures follow the base class | `src/index.js` |
|
|
604
|
+
| Package entry point | All consumers | Published | The entry resolves to the built output, with a source entry for development | `package.json` |
|
|
605
|
+
|
|
606
|
+
The module has no TypeScript declarations of its own. `src/index.js` re-exports all sixteen classes in
|
|
607
|
+
this module; the package declares its entry points in `package.json`.
|
|
608
|
+
|
|
609
|
+
## Key design trade-off
|
|
610
|
+
|
|
611
|
+
| Chosen trade-off | Preserved invariant or benefit | Cost or limitation | Decision evidence |
|
|
612
|
+
| --- | --- | --- | --- |
|
|
613
|
+
| Replay and redirect re-enter webex.request instead of resuming the chain | Every leg gets fresh headers, tracking id, auth, timing, and events with no special-case code | Counters must live on the options object; events and timings repeat per leg; a skipped counter disables the ceiling | `src/interceptors/auth.js`, `src/interceptors/redirect.js` |
|
|
614
|
+
| One options object threaded and mutated through the chain, with `$`-prefixed and replayCount markers | No signature changes needed to add a cross-cutting concern | Shallow clones share `headers`; reusing an options object carries markers into the next request | `src/interceptors/redirect.js`, `src/interceptors/request-timing.js` |
|
|
615
|
+
| Wrapping order encoded by pre and post name lists | Timing, events, and logging bracket all other behavior; status conversion is adjacent to the transport | Order is implicit in a list outside this module; `RateLimitInterceptor` appears in both lists | `src/webex-core.js`, `test/unit/spec/webex-core.js` |
|
|
616
|
+
| Catalog URL validation is opt-in | Existing integrations that call arbitrary hosts keep working | The default configuration does not block untrusted URLs | `src/webex-core.js`, `src/config.js` |
|
|
617
|
+
| Fail-open when the services plugin is missing | Startup and tests without services are not blocked | A chain built without services performs no URL validation and adds no token | `src/interceptors/catalog-url.js`, `src/interceptors/auth.js` |
|
|
618
|
+
|
|
619
|
+
## Verification
|
|
620
|
+
|
|
621
|
+
| Requirement or invariant | Test level | Positive evidence | Negative or boundary evidence | Gap |
|
|
622
|
+
| --- | --- | --- | --- | --- |
|
|
623
|
+
| `INT-001` to `INT-006` | Unit | `test/unit/spec/interceptors/auth.js` | `test/unit/spec/interceptors/auth.js` (falsy header, no services, unknown URI, addAuthHeader false, non-allowed domain) | The `waitForService` failure branch is not asserted directly |
|
|
624
|
+
| `INT-007`, `INT-008` | Unit + Integration | `test/unit/spec/interceptors/auth.js`, `test/integration/spec/unit-browser/auth.js` (refresh and replay count) | `test/unit/spec/interceptors/auth.js` (not refreshable, shouldRefreshAccessToken false) | Integration tier needs provisioned users |
|
|
625
|
+
| `INT-009` | None | none found | none found | The over-limit rejection is unasserted |
|
|
626
|
+
| `INT-010` to `INT-012` | Unit | `test/unit/spec/interceptors/catalog-url.js` | `test/unit/spec/interceptors/catalog-url.js` (malicious and look-alike hosts, missing services) | The `warn` log is not asserted |
|
|
627
|
+
| `INT-013` | Unit (parent, `MOD-025`) | `test/unit/spec/webex-core.js` | `test/unit/spec/webex-core.js` (truthy non-boolean) | none |
|
|
628
|
+
| `INT-014` | Unit | `test/unit/spec/interceptors/default-options.js` | `test/unit/spec/interceptors/default-options.js` (undefined config, no override) | none |
|
|
629
|
+
| `INT-015` | Unit | `test/unit/spec/interceptors/embargo.js` | `test/unit/spec/interceptors/embargo.js` (non-451, device absent) | none |
|
|
630
|
+
| `INT-016` | Unit | `test/unit/spec/interceptors/network-timing.js` | none found | The error branch is untested |
|
|
631
|
+
| `INT-017` | Unit | `test/unit/spec/interceptors/request-timing.js` | none found | The rejection value of `onRequestError` is not asserted, so the options-instead-of-reason behavior is unobserved |
|
|
632
|
+
| `INT-018` | Unit | `test/unit/spec/interceptors/payload-transformer.js` | `test/unit/spec/interceptors/payload-transformer.js` (disabled transform) | The `noTransform` skip is not asserted |
|
|
633
|
+
| `INT-019` | Unit | `test/unit/spec/interceptors/payload-transformer.js` (once, concurrent share, retry after failure, non-enumerable) | `test/unit/spec/interceptors/payload-transformer.js` (distinct responses, errors) | none |
|
|
634
|
+
| `INT-020` | Unit | `test/unit/spec/interceptors/proxy.js` | `test/unit/spec/interceptors/proxy.js` (no proxy, browser) | none |
|
|
635
|
+
| `INT-021` | Unit | `test/unit/spec/interceptors/rate-limit.js` (negative paths only) | `test/unit/spec/interceptors/rate-limit.js` (expired, non-identity, null) | Every positive case is skipped; the defect in Pitfalls is hidden by that |
|
|
636
|
+
| `INT-022` | Unit | `test/unit/spec/interceptors/rate-limit.js` | `test/unit/spec/interceptors/rate-limit.js` (null, zero, above 3600) | none |
|
|
637
|
+
| `INT-023` | None | none found | none found | The request side of redirect is untested |
|
|
638
|
+
| `INT-024` | None | none found | none found | The `cisco-location` form is untested |
|
|
639
|
+
| `INT-025`, `INT-026`, `INV-005` | Unit | `test/unit/spec/interceptors/redirect.js` (GET and POST, preJoin) | `test/unit/spec/interceptors/redirect.js` (ceiling, no redirect, non-preJoin) | The `NaN` count case is untested |
|
|
640
|
+
| `INT-027` | None | none found | none found | No test covers `src/interceptors/request-event.js` |
|
|
641
|
+
| `INT-028` | Unit | `test/unit/spec/interceptors/webex-tracking-id.js` | `test/unit/spec/interceptors/webex-tracking-id.js` (preset header) | The falsy-header deletion is untested |
|
|
642
|
+
| `INT-029` | None | none found | none found | The replay suffix is untested |
|
|
643
|
+
| `INT-030` | Unit | `test/unit/spec/interceptors/webex-user-agent.js` | `test/unit/spec/interceptors/webex-user-agent.js` | Identity-URL exclusions and header deletion are untested |
|
|
644
|
+
| `INT-031` | Unit (Node) | `test/unit/spec/interceptors/user-agent.js` | none found | Browser branch not asserted; Node-only cases are skipped in a browser run |
|
|
645
|
+
| `INT-032` | None | none found | none found | Neither logger has a test |
|
|
646
|
+
| `INT-033` | Unit (parent, `MOD-023`) | `test/unit/spec/webex-core.js` | `test/unit/spec/webex-core.js` (custom set, empty set) | Request-versus-response ordering is checked through list contents, not by driving a request |
|
|
647
|
+
| `INV-001` | Unit | `test/unit/spec/interceptors/catalog-url.js` | `test/unit/spec/webex-core.js` (opt-in gate, parent) | The enforcement is split across two files; no test drives a real request through the gate |
|
|
648
|
+
| `INV-002` | Unit | `test/unit/spec/interceptors/auth.js`, `test/unit/spec/interceptors/webex-tracking-id.js`, `test/unit/spec/interceptors/webex-user-agent.js` | none found | No test for `cisco-no-http-redirect` caller precedence; falsy-header deletion is untested for tracking id |
|
|
649
|
+
| `INV-003` | Unit | `test/unit/spec/interceptors/redirect.js` | `test/unit/spec/interceptors/redirect.js` (ceiling) | The auth replay ceiling is unasserted (`INT-009`) and a skipped counter disables the redirect ceiling |
|
|
650
|
+
| `INV-004` | Unit | `test/unit/spec/interceptors/embargo.js` | `test/unit/spec/interceptors/embargo.js` (non-451) | none |
|
|
651
|
+
|
|
652
|
+
Unit tests for this module run under Jest through the package's `test:unit` script
|
|
653
|
+
(`package.json`); there are roughly 120 test cases across 13 files in `test/unit/spec/interceptors`,
|
|
654
|
+
ten of them skipped. Several files (`proxy`, `user-agent`) are gated by browser-or-Node helpers, so
|
|
655
|
+
each platform runs a subset. Three of the sixteen classes have no unit test file: `request-event`,
|
|
656
|
+
`request-logger`, and `response-logger`.
|
|
657
|
+
|
|
658
|
+
Generator-side field measurement for this module is complete (see the coverage score above); independent validation is recorded in Metadata and drift remains unmeasured until it passes.
|